mainform.ui.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698
  1. /****************************************************************************
  2. ** ui.h extension file, included from the uic-generated form implementation.
  3. **
  4. ** If you wish to add, delete or rename slots use Qt Designer which will
  5. ** update this file, preserving your code. Create an init() slot in place of
  6. ** a constructor, and a destroy() slot in place of a destructor.
  7. *****************************************************************************/
  8. /*
  9. ktigcc - TIGCC IDE for KDE
  10. Copyright (C) 2004-2005 Kevin Kofler
  11. This program is free software; you can redistribute it and/or modify
  12. it under the terms of the GNU General Public License as published by
  13. the Free Software Foundation; either version 2, or (at your option)
  14. any later version.
  15. This program is distributed in the hope that it will be useful,
  16. but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. GNU General Public License for more details.
  19. You should have received a copy of the GNU General Public License
  20. along with this program; if not, write to the Free Software Foundation,
  21. Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  22. */
  23. #include <qlabel.h>
  24. #include <qstatusbar.h>
  25. #include <qtimer.h>
  26. #include <qdatetime.h>
  27. #include <qdragobject.h>
  28. #include <kparts/factory.h>
  29. #include <klibloader.h>
  30. #include <kate/document.h>
  31. #include <kate/view.h>
  32. #include <kconfig.h>
  33. #include <ktexteditor/configinterfaceextension.h>
  34. #include <kaboutdata.h>
  35. #include <khelpmenu.h>
  36. #include <cstdio>
  37. #include <cstdlib>
  38. using std::puts;
  39. using std::exit;
  40. extern const char *tigcc_base;
  41. extern const char *quill_drv;
  42. extern char tempdir[];
  43. extern void write_temp_file(const char *filename, const char *data, const size_t len);
  44. extern void delete_temp_file(const char *filename);
  45. extern KAboutData *pabout;
  46. // All the methods are inline because otherwise QT Designer will mistake them
  47. // for slots of the main form.
  48. class ListViewFolder : public QListViewItem {
  49. public:
  50. ListViewFolder(QListView *parent) : QListViewItem(parent)
  51. {
  52. setPixmap(0,QPixmap::fromMimeSource("folder1.png"));
  53. setDragEnabled(TRUE);
  54. setDropEnabled(TRUE);
  55. }
  56. ListViewFolder(QListViewItem *parent) : QListViewItem(parent)
  57. {
  58. setPixmap(0,QPixmap::fromMimeSource("folder1.png"));
  59. setDragEnabled(TRUE);
  60. setDropEnabled(TRUE);
  61. }
  62. ListViewFolder(QListView *parent, QListViewItem *after)
  63. : QListViewItem(parent, after)
  64. {
  65. setPixmap(0,QPixmap::fromMimeSource("folder1.png"));
  66. setDropEnabled(TRUE);
  67. setDragEnabled(TRUE);
  68. }
  69. ListViewFolder(QListViewItem *parent, QListViewItem *after)
  70. : QListViewItem(parent, after)
  71. {
  72. setPixmap(0,QPixmap::fromMimeSource("folder1.png"));
  73. setDragEnabled(TRUE);
  74. setDropEnabled(TRUE);
  75. }
  76. virtual int rtti(void) const {return 0x716CC0;}
  77. protected:
  78. };
  79. class ListViewFile : public QListViewItem {
  80. public:
  81. ListViewFile(QListView *parent) : QListViewItem(parent)
  82. {
  83. setPixmap(0,QPixmap::fromMimeSource("filex.png"));
  84. setDragEnabled(TRUE);
  85. setDropEnabled(TRUE);
  86. setRenameEnabled(0,TRUE);
  87. }
  88. ListViewFile(QListViewItem *parent) : QListViewItem(parent)
  89. {
  90. setPixmap(0,QPixmap::fromMimeSource("filex.png"));
  91. setDragEnabled(TRUE);
  92. setDropEnabled(TRUE);
  93. setRenameEnabled(0,TRUE);
  94. }
  95. ListViewFile(QListView *parent, QListViewItem *after)
  96. : QListViewItem(parent, after)
  97. {
  98. setPixmap(0,QPixmap::fromMimeSource("filex.png"));
  99. setDropEnabled(TRUE);
  100. setDragEnabled(TRUE);
  101. setRenameEnabled(0,TRUE);
  102. }
  103. ListViewFile(QListViewItem *parent, QListViewItem *after)
  104. : QListViewItem(parent, after)
  105. {
  106. setPixmap(0,QPixmap::fromMimeSource("filex.png"));
  107. setDragEnabled(TRUE);
  108. setDropEnabled(TRUE);
  109. setRenameEnabled(0,TRUE);
  110. }
  111. virtual int rtti(void) const {return 0x716CC1;}
  112. QString textBuffer;
  113. protected:
  114. };
  115. // These should be instance variables in clean C++, but QT Designer won't let me
  116. // touch the class definition, so this is all I can do. And there is only one
  117. // instance of MainForm anyway.
  118. static QListViewItem *rootListItem;
  119. static QListViewItem *hFilesListItem;
  120. static QListViewItem *cFilesListItem;
  121. static QListViewItem *sFilesListItem;
  122. static QListViewItem *asmFilesListItem;
  123. static QListViewItem *qllFilesListItem;
  124. static QListViewItem *oFilesListItem;
  125. static QListViewItem *aFilesListItem;
  126. static QListViewItem *txtFilesListItem;
  127. static QListViewItem *othFilesListItem;
  128. static QListViewItem *currentListItem;
  129. static QLabel *leftStatusLabel;
  130. static QLabel *rightStatusLabel;
  131. static Kate::View* m_view;
  132. static KHelpMenu *khelpmenu;
  133. static int fileCount=0, hFileCount=0, cFileCount=0, sFileCount=0, asmFileCount=0, qllFileCount=0, oFileCount=0, aFileCount=0, txtFileCount=0, othFileCount=0;
  134. class DnDListView : public QListView {
  135. private:
  136. public:
  137. DnDListView ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )
  138. : QListView(parent,name,f) {}
  139. protected:
  140. virtual QDragObject *dragObject() {
  141. QListViewItem *currItem=selectedItem();
  142. if (currItem==rootListItem || currItem->parent()==rootListItem)
  143. return NULL;
  144. QStoredDrag *storedDrag=new QStoredDrag("x-ktigcc-folder", this);
  145. static QByteArray data(sizeof(QListViewItem*));
  146. data.duplicate(reinterpret_cast<char *>(currItem),
  147. sizeof(QListViewItem*));
  148. storedDrag->setEncodedData(data);
  149. return storedDrag;
  150. }
  151. virtual void dropEvent (QDropEvent *e) {
  152. if (e->source()==this) {
  153. QPoint vp=contentsToViewport(e->pos());
  154. QListViewItem *item=itemAt(vp);
  155. if (item && item->rtti()==0x716CC0) {
  156. // drop on file
  157. } else if (item && item->rtti()==0x716CC1) {
  158. // drop on folder
  159. } else e->ignore();
  160. } else e->ignore();
  161. }
  162. virtual void dragEnterEvent (QDragEnterEvent *e) {
  163. if (e->source()==this&&(e->provides("x-ktigcc-folder")
  164. ||e->provides("x-ktigcc-file")))
  165. e->accept();
  166. }
  167. };
  168. void MainForm::init()
  169. {
  170. fileNewFolderAction->setEnabled(FALSE);
  171. KParts::Factory* factory = (KParts::Factory *)
  172. KLibLoader::self()->factory ("libkatepart");
  173. if (!factory) exit(1);
  174. KTextEditor::Document *doc = (KTextEditor::Document *)
  175. factory->createPart( 0, "", this, "", "KTextEditor::Document" );
  176. m_view = (Kate::View *) doc->createView( splitter, 0L );
  177. m_view->setEnabled(FALSE);
  178. m_view->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding,0,0));
  179. write_temp_file("config.tmp","[Kate Renderer Defaults]\nSchema=ktigcc - Grayed Out\n",0);
  180. KConfig kconfig(QString(tempdir)+"/config.tmp",true);
  181. m_view->getDoc()->readConfig(&kconfig);
  182. delete_temp_file("config.tmp");
  183. m_view->getDoc()->setHlMode(0);
  184. QValueList<int> list;
  185. list.append(150);
  186. list.append(500);
  187. splitter->setSizes(list);
  188. leftStatusLabel=new QLabel("0 Files Total",this);
  189. leftStatusLabel->setMaximumWidth(splitter->sizes().first());
  190. statusBar()->addWidget(leftStatusLabel,1);
  191. rightStatusLabel=new QLabel("",this);
  192. rightStatusLabel->setMaximumWidth(splitter->sizes().last());
  193. statusBar()->addWidget(rightStatusLabel,1);
  194. statusBar()->setSizeGripEnabled(FALSE);
  195. fileTree->setSorting(-1);
  196. fileTree->setColumnWidthMode(0,QListView::Maximum);
  197. rootListItem=new QListViewItem(fileTree);
  198. rootListItem->setText(0,"Project1");
  199. rootListItem->setPixmap(0,QPixmap::fromMimeSource("tpr.png"));
  200. rootListItem->setOpen(TRUE);
  201. rootListItem->setDragEnabled(TRUE);
  202. QListViewItem *folderListItem=new ListViewFolder(rootListItem);
  203. hFilesListItem=folderListItem;
  204. folderListItem->setText(0,"Header Files");
  205. folderListItem=new ListViewFolder(rootListItem,folderListItem);
  206. cFilesListItem=folderListItem;
  207. folderListItem->setText(0,"C Files");
  208. folderListItem=new ListViewFolder(rootListItem,folderListItem);
  209. sFilesListItem=folderListItem;
  210. folderListItem->setText(0,"GNU Assembly Files");
  211. folderListItem=new ListViewFolder(rootListItem,folderListItem);
  212. asmFilesListItem=folderListItem;
  213. folderListItem->setText(0,"A68k Assembly Files");
  214. if (quill_drv) {
  215. folderListItem=new ListViewFolder(rootListItem,folderListItem);
  216. qllFilesListItem=folderListItem;
  217. folderListItem->setText(0,"Quill Files");
  218. } else {
  219. qllFilesListItem=NULL;
  220. fileNewQuillSourceFileAction->setVisible(FALSE);
  221. }
  222. folderListItem=new ListViewFolder(rootListItem,folderListItem);
  223. oFilesListItem=folderListItem;
  224. folderListItem->setText(0,"Object Files");
  225. folderListItem=new ListViewFolder(rootListItem,folderListItem);
  226. aFilesListItem=folderListItem;
  227. folderListItem->setText(0,"Archive Files");
  228. folderListItem=new ListViewFolder(rootListItem,folderListItem);
  229. txtFilesListItem=folderListItem;
  230. folderListItem->setText(0,"Text Files");
  231. folderListItem=new ListViewFolder(rootListItem,folderListItem);
  232. othFilesListItem=folderListItem;
  233. folderListItem->setText(0,"Other Files");
  234. khelpmenu=new KHelpMenu(this,pabout);
  235. startTimer(100);
  236. }
  237. void MainForm::destroy()
  238. {
  239. Kate::Document *doc=m_view->getDoc();
  240. delete m_view;
  241. delete doc;
  242. delete leftStatusLabel;
  243. delete rightStatusLabel;
  244. delete rootListItem;
  245. delete khelpmenu;
  246. }
  247. void MainForm::fileNewProject()
  248. {
  249. rootListItem->setText(0,"Project1");
  250. fileTreeClicked(rootListItem);
  251. QListViewItem *f, *next;
  252. for (f=hFilesListItem->firstChild();f;f=next) {
  253. next=f->nextSibling();
  254. delete f;
  255. }
  256. for (f=cFilesListItem->firstChild();f;f=next) {
  257. next=f->nextSibling();
  258. delete f;
  259. }
  260. for (f=sFilesListItem->firstChild();f;f=next) {
  261. next=f->nextSibling();
  262. delete f;
  263. }
  264. for (f=asmFilesListItem->firstChild();f;f=next) {
  265. next=f->nextSibling();
  266. delete f;
  267. }
  268. if (qllFilesListItem) {
  269. for (f=qllFilesListItem->firstChild();f;f=next) {
  270. next=f->nextSibling();
  271. delete f;
  272. }
  273. }
  274. for (f=oFilesListItem->firstChild();f;f=next) {
  275. next=f->nextSibling();
  276. delete f;
  277. }
  278. for (f=aFilesListItem->firstChild();f;f=next) {
  279. next=f->nextSibling();
  280. delete f;
  281. }
  282. for (f=txtFilesListItem->firstChild();f;f=next) {
  283. next=f->nextSibling();
  284. delete f;
  285. }
  286. for (f=othFilesListItem->firstChild();f;f=next) {
  287. next=f->nextSibling();
  288. delete f;
  289. }
  290. fileCount=cFileCount=hFileCount=sFileCount=asmFileCount=qllFileCount=oFileCount=aFileCount=txtFileCount=othFileCount=0;
  291. updateLeftStatusLabel();
  292. }
  293. void MainForm::fileOpen()
  294. {
  295. }
  296. void MainForm::fileSave()
  297. {
  298. }
  299. void MainForm::fileSaveAs()
  300. {
  301. }
  302. void MainForm::filePrint()
  303. {
  304. }
  305. void MainForm::fileExit()
  306. {
  307. }
  308. void MainForm::editUndo()
  309. {
  310. }
  311. void MainForm::editRedo()
  312. {
  313. }
  314. void MainForm::editCut()
  315. {
  316. }
  317. void MainForm::editCopy()
  318. {
  319. }
  320. void MainForm::editPaste()
  321. {
  322. }
  323. void MainForm::editFind()
  324. {
  325. }
  326. void MainForm::helpIndex()
  327. {
  328. }
  329. void MainForm::helpContents()
  330. {
  331. }
  332. void MainForm::helpAbout()
  333. {
  334. khelpmenu->aboutApplication();
  335. }
  336. void MainForm::updateSizes()
  337. {
  338. int leftSize=splitter->sizes().first();
  339. int rightSize=splitter->sizes().last();
  340. int totalSize=leftSize+rightSize;
  341. int mySize=size().width();
  342. leftStatusLabel->setMaximumWidth(leftSize*mySize/totalSize);
  343. rightStatusLabel->setMaximumWidth(rightSize*mySize/totalSize-10>0?
  344. rightSize*mySize/totalSize-10:0);
  345. }
  346. void MainForm::resizeEvent(QResizeEvent *event)
  347. {
  348. QMainWindow::resizeEvent(event);
  349. if (event->size()==event->oldSize()) return;
  350. updateSizes();
  351. }
  352. void MainForm::timerEvent(QTimerEvent *event)
  353. {
  354. static int lastSplitterPos=-1;
  355. QMainWindow::timerEvent(event);
  356. if (lastSplitterPos==splitter->sizes().first()) return;
  357. lastSplitterPos=splitter->sizes().first();
  358. updateSizes();
  359. }
  360. void MainForm::fileTreeClicked(QListViewItem *item)
  361. {
  362. if (!item) return;
  363. if (currentListItem && currentListItem->rtti()==0x716CC0)
  364. currentListItem->setPixmap(0,QPixmap::fromMimeSource("folder1.png"));
  365. if (currentListItem && currentListItem->rtti()==0x716CC1)
  366. static_cast<ListViewFile *>(currentListItem)->textBuffer=m_view->getDoc()->text();
  367. if (item->rtti()==0x716CC0) {
  368. item->setPixmap(0,QPixmap::fromMimeSource("folder2.png"));
  369. fileNewFolderAction->setEnabled(TRUE);
  370. m_view->setEnabled(FALSE);
  371. m_view->getDoc()->setText("");
  372. write_temp_file("config.tmp","[Kate Renderer Defaults]\nSchema=ktigcc - Grayed Out\n",0);
  373. KConfig kconfig(QString(tempdir)+"/config.tmp",true);
  374. m_view->getDoc()->readConfig(&kconfig);
  375. delete_temp_file("config.tmp");
  376. m_view->getDoc()->setHlMode(0);
  377. } else if (item->rtti()==0x716CC1) {
  378. fileNewFolderAction->setEnabled(TRUE);
  379. m_view->setEnabled(TRUE);
  380. m_view->getDoc()->setText(static_cast<ListViewFile *>(item)->textBuffer);
  381. QListViewItem *category=item->parent();
  382. while (category->parent()->rtti()==0x716CC0) category=category->parent();
  383. const char *buffer=static_cast<ListViewFile *>(item)->textBuffer;
  384. write_temp_file("config.tmp","[Kate Renderer Defaults]\nSchema=kate - Normal\n",0);
  385. KConfig kconfig(QString(tempdir)+"/config.tmp",true);
  386. m_view->getDoc()->readConfig(&kconfig);
  387. delete_temp_file("config.tmp");
  388. uint cnt=m_view->getDoc()->hlModeCount(), i;
  389. for (i=0; i<cnt; i++) {
  390. if (!m_view->getDoc()->hlModeName(i).compare(
  391. ((category==sFilesListItem||(category==hFilesListItem&&buffer&&*buffer=='|'))?
  392. "GNU Assembler 68k":
  393. (category==asmFilesListItem||(category==hFilesListItem&&buffer&&*buffer==';'))?
  394. "Motorola Assembler 68k":
  395. (category==cFilesListItem||category==qllFilesListItem||category==hFilesListItem)?
  396. "C":
  397. "None"))) break;
  398. }
  399. if (i==cnt) i=0;
  400. m_view->getDoc()->setHlMode(i);
  401. } else {
  402. fileNewFolderAction->setEnabled(FALSE);
  403. m_view->setEnabled(FALSE);
  404. m_view->getDoc()->setText("");
  405. write_temp_file("config.tmp","[Kate Renderer Defaults]\nSchema=ktigcc - Grayed Out\n",0);
  406. KConfig kconfig(QString(tempdir)+"/config.tmp",true);
  407. m_view->getDoc()->readConfig(&kconfig);
  408. delete_temp_file("config.tmp");
  409. m_view->getDoc()->setHlMode(0);
  410. }
  411. currentListItem=item;
  412. updateLeftStatusLabel();
  413. }
  414. void MainForm::fileNewFolder()
  415. {
  416. if (currentListItem->rtti()==0x716CC1)
  417. currentListItem=currentListItem->parent();
  418. QListViewItem *item=NULL, *next=currentListItem->firstChild();
  419. for (; next && next->rtti()==0x716CC0; next=item->nextSibling())
  420. item=next;
  421. QListViewItem *newFolder=item?new ListViewFolder(currentListItem,item)
  422. :new ListViewFolder(currentListItem);
  423. newFolder->setText(0,"NewFolder");
  424. newFolder->setRenameEnabled(0,TRUE);
  425. currentListItem->setOpen(TRUE);
  426. fileTreeClicked(newFolder);
  427. newFolder->startRename(0);
  428. }
  429. #define unused_col __attribute__((unused)) col /* stupid QT designer... */
  430. void MainForm::fileTreeContextMenuRequested(QListViewItem *item,
  431. const QPoint &pos,
  432. int unused_col)
  433. {
  434. fileTreeClicked(item);
  435. if (item && item->rtti()==0x716CC0) {
  436. QPopupMenu menu;
  437. menu.insertItem("New &Folder",0);
  438. menu.insertItem("New F&ile",1);
  439. QListViewItem *category=item;
  440. while (category->parent()->rtti()==0x716CC0) category=category->parent();
  441. if (category==oFilesListItem || category==aFilesListItem
  442. || category==othFilesListItem) menu.setItemEnabled(1,FALSE);
  443. if (!(item==hFilesListItem || item==cFilesListItem || item==sFilesListItem
  444. || item==asmFilesListItem || item && item==qllFilesListItem
  445. || item==oFilesListItem || item==aFilesListItem
  446. || item==txtFilesListItem || item==othFilesListItem)) {
  447. menu.insertSeparator();
  448. menu.insertItem("&Remove",2);
  449. menu.insertItem("Re&name",3);
  450. }
  451. switch (menu.exec(pos)) {
  452. case 0:
  453. fileNewFolder();
  454. break;
  455. case 1:
  456. newFile(item);
  457. break;
  458. case 2:
  459. delete item;
  460. currentListItem=NULL;
  461. fileTreeClicked(fileTree->currentItem());
  462. break;
  463. case 3:
  464. item->startRename(0);
  465. }
  466. }
  467. }
  468. void MainForm::newFile( QListViewItem *parent, QString text, const char *iconName )
  469. {
  470. QListViewItem *item=NULL, *next=parent->firstChild();
  471. for (; next; next=item->nextSibling())
  472. item=next;
  473. ListViewFile *newFile=item?new ListViewFile(parent,item)
  474. :new ListViewFile(parent);
  475. newFile->setText(0,"New File");
  476. newFile->setPixmap(0,QPixmap::fromMimeSource(iconName));
  477. parent->setOpen(TRUE);
  478. newFile->textBuffer=text;
  479. fileTreeClicked(newFile);
  480. newFile->startRename(0);
  481. m_view->getDoc()->setText(text);
  482. fileCount++;
  483. QListViewItem *category=parent;
  484. while (category->parent()->rtti()==0x716CC0) category=category->parent();
  485. (category==hFilesListItem?hFileCount:category==cFilesListItem?cFileCount:
  486. category==sFilesListItem?sFileCount:category==asmFilesListItem?asmFileCount:
  487. category==qllFilesListItem?qllFileCount:category==oFilesListItem?oFileCount:
  488. category==aFilesListItem?aFileCount:category==txtFilesListItem?txtFileCount:
  489. othFileCount)++;
  490. updateLeftStatusLabel();
  491. }
  492. void MainForm::newFile( QListViewItem *parent )
  493. {
  494. QListViewItem *category=parent;
  495. while (category->parent()->rtti()==0x716CC0) category=category->parent();
  496. newFile(parent,category==txtFilesListItem?"":
  497. ((category==hFilesListItem?"// Header File\n//":
  498. category==cFilesListItem?"// C Source File\n//":
  499. category==sFilesListItem?"| Assembly Source File\n|":
  500. category==asmFilesListItem?"; Assembly Source File\n;":
  501. category==qllFilesListItem?"// Quill Source File\n//":"???\n")
  502. +QString(" Created ")
  503. +QDateTime::currentDateTime ().toString(Qt::LocalDate)+"\n"+
  504. QString(category==cFilesListItem?(cFileCount?
  505. "\n#include <tigcclib.h>\n":
  506. "\n// Delete or comment out the items you do not need.\n"
  507. "#define COMMENT_STRING \"Place your comment here.\"\n"
  508. "#define COMMENT_PROGRAM_NAME "
  509. "\"Place your program name here.\"\n"
  510. "#define COMMENT_VERSION_STRING "
  511. "\"Place your version string here.\"\n"
  512. "#define COMMENT_VERSION_NUMBER 0,0,0,0 "
  513. "/* major, minor, revision, subrevision */\n"
  514. "#define COMMENT_AUTHORS "
  515. "\"Place your author name(s) here.\"\n"
  516. "#define COMMENT_BW_ICON \\\n"
  517. "\t{0b0000000000000000, \\\n"
  518. "\t 0b0000000000000000, \\\n"
  519. "\t 0b0000000000000000, \\\n"
  520. "\t 0b0000000000000000, \\\n"
  521. "\t 0b0000000000000000, \\\n"
  522. "\t 0b0000000000000000, \\\n"
  523. "\t 0b0000000000000000, \\\n"
  524. "\t 0b0000000000000000, \\\n"
  525. "\t 0b0000000000000000, \\\n"
  526. "\t 0b0000000000000000, \\\n"
  527. "\t 0b0000000000000000, \\\n"
  528. "\t 0b0000000000000000, \\\n"
  529. "\t 0b0000000000000000, \\\n"
  530. "\t 0b0000000000000000, \\\n"
  531. "\t 0b0000000000000000, \\\n"
  532. "\t 0b0000000000000000}\n"
  533. "#define COMMENT_GRAY_ICON \\\n"
  534. "\t{0b0000000000000000, \\\n"
  535. "\t 0b0000000000000000, \\\n"
  536. "\t 0b0000000000000000, \\\n"
  537. "\t 0b0000000000000000, \\\n"
  538. "\t 0b0000000000000000, \\\n"
  539. "\t 0b0000000000000000, \\\n"
  540. "\t 0b0000000000000000, \\\n"
  541. "\t 0b0000000000000000, \\\n"
  542. "\t 0b0000000000000000, \\\n"
  543. "\t 0b0000000000000000, \\\n"
  544. "\t 0b0000000000000000, \\\n"
  545. "\t 0b0000000000000000, \\\n"
  546. "\t 0b0000000000000000, \\\n"
  547. "\t 0b0000000000000000, \\\n"
  548. "\t 0b0000000000000000, \\\n"
  549. "\t 0b0000000000000000}, \\\n"
  550. "\t{0b0000000000000000, \\\n"
  551. "\t 0b0000000000000000, \\\n"
  552. "\t 0b0000000000000000, \\\n"
  553. "\t 0b0000000000000000, \\\n"
  554. "\t 0b0000000000000000, \\\n"
  555. "\t 0b0000000000000000, \\\n"
  556. "\t 0b0000000000000000, \\\n"
  557. "\t 0b0000000000000000, \\\n"
  558. "\t 0b0000000000000000, \\\n"
  559. "\t 0b0000000000000000, \\\n"
  560. "\t 0b0000000000000000, \\\n"
  561. "\t 0b0000000000000000, \\\n"
  562. "\t 0b0000000000000000, \\\n"
  563. "\t 0b0000000000000000, \\\n"
  564. "\t 0b0000000000000000, \\\n"
  565. "\t 0b0000000000000000}\n\n#include <tigcclib.h>\n\n"
  566. "// Main Function\nvoid _main(void)\n{\n"
  567. "\t// Place your code here.\n}\n"):"")),
  568. category==cFilesListItem||category==qllFilesListItem
  569. ?"filec.png":
  570. category==hFilesListItem?"fileh.png":
  571. category==sFilesListItem||category==asmFilesListItem
  572. ?"files.png":
  573. category==txtFilesListItem?"filet.png":"filex.png");
  574. }
  575. void MainForm::fileNewCHeader()
  576. {
  577. newFile(hFilesListItem,"// Header File\n// Created "+QDateTime::currentDateTime ().toString(Qt::LocalDate)+"\n","fileh.png");
  578. }
  579. void MainForm::fileNewGNUAssemblyHeader()
  580. {
  581. newFile(hFilesListItem,"| Header File\n| Created "+QDateTime::currentDateTime ().toString(Qt::LocalDate)+"\n","fileh.png");
  582. }
  583. void MainForm::fileNewA68kAssemblyHeader()
  584. {
  585. newFile(hFilesListItem,"; Header File\n; Created "+QDateTime::currentDateTime ().toString(Qt::LocalDate)+"\n","fileh.png");
  586. }
  587. void MainForm::fileNewCSourceFile()
  588. {
  589. newFile(cFilesListItem,"// C Source File\n// Created "+QDateTime::currentDateTime ().toString(Qt::LocalDate)+"\n","filec.png");
  590. }
  591. void MainForm::fileNewGNUAssemblySourceFile()
  592. {
  593. newFile(sFilesListItem,"| Assembly Source File\n| Created "+QDateTime::currentDateTime ().toString(Qt::LocalDate)+"\n","files.png");
  594. }
  595. void MainForm::fileNewA68kAssemblySourceFile()
  596. {
  597. newFile(asmFilesListItem,"; Assembly Source File\n; Created "+QDateTime::currentDateTime ().toString(Qt::LocalDate)+"\n","files.png");
  598. }
  599. void MainForm::fileNewQuillSourceFile()
  600. {
  601. newFile(qllFilesListItem,"// Quill Source File\n// Created "+QDateTime::currentDateTime ().toString(Qt::LocalDate)+"\n","filec.png");
  602. }
  603. void MainForm::fileNewTextFile()
  604. {
  605. newFile(txtFilesListItem,"","filet.png");
  606. }
  607. void MainForm::updateLeftStatusLabel()
  608. {
  609. QString text=QString::number(fileCount)+QString(" File")
  610. +QString(fileCount!=1?"s":"")+QString(" Total");
  611. QListViewItem *category=currentListItem;
  612. if (currentListItem->rtti()==0x716CC0||currentListItem->rtti()==0x716CC1) {
  613. while (category->parent()->rtti()==0x716CC0) category=category->parent();
  614. text+=QString(", ")+QString::number(category==hFilesListItem?hFileCount:
  615. category==cFilesListItem?cFileCount:
  616. category==sFilesListItem?sFileCount:
  617. category==asmFilesListItem?asmFileCount:
  618. category==qllFilesListItem?qllFileCount:
  619. category==oFilesListItem?oFileCount:
  620. category==aFilesListItem?aFileCount:
  621. category==txtFilesListItem?txtFileCount:
  622. othFileCount)
  623. +QString(" in Category");
  624. }
  625. leftStatusLabel->setText(text);
  626. }
  627. // Yes, this is an ugly hack... Any better suggestions?
  628. #define QListView DnDListView