1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
|
/***************************************************************************
quanta.h - description
-------------------
begin : ?? ??? 9 13:29:57 EEST 2000
copyright : (C) 2000 by Dmitry Poplavsky & Alexander Yakovlev & Eric Laffoon <pdima@users.sourceforge.net,yshurik@linuxfan.com,sequitur@easystreet.com>
(C) 2001-2004 by Andras Mantia <amantia@kde.org>
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QUANTA_H
#define QUANTA_H
#define QUANTA_PACKAGE "quanta"
#define QUANTA_VERSION "3.5.13"
#define IDS_STATUS 1
#define IDS_INS_OVR 2
#define IDS_MODIFIED 3
#define IDS_STATUS_CLM 4
// Number 5 is used by the debugger, but not added until debugger is activated
#define IDS_STATUS_DEBUGGER 5
#define IDS_DEFAULT "Ready."
// include files for TQt
#include <tqmap.h>
#include <tqdict.h>
#include <tqvaluelist.h>
#include <tqstrlist.h>
#include <tqptrlist.h>
// include files for KDE
#include <tdeversion.h>
#include <kdockwidget.h>
#include <tdeparts/browserextension.h>
#include <tdeparts/dockmainwindow.h>
#include <tdemdimainfrm.h>
//app includes
#include "dcopwindowmanagerif.h"
// forward declaration
class DCOPSettings;
class DCOPQuanta;
class QuantaPluginInterface;
class QuantaDoc;
class QuantaView;
class QNewDTEPStuff;
class QNewToolbarStuff;
class QNewTemplateStuff;
class QNewScriptStuff;
class QNewDocStuff;
class TQTabWidget;
class TQWidgetStack;
class TQListViewItem;
class TQPopupMenu;
class WHTMLPart;
class TDEHTMLView;
class TDEAction;
class TDEToggleAction;
class TDEProcess;
class TDESelectAction;
class TDERecentFilesAction;
class TDEToolBarPoupAction;
class KTextEdit;
class TagAction;
class Node;
class Parser;
class DocTreeView;
class FilesTreeView;
class ScriptTreeView;
class EnhancedTagAttributeTree;
class Project;
class AnnotationOutput;
class MessageOutput;
class TQDomDocument;
class Document;
class DebuggerManager;
class QuantaInit;
class TDEToolBarPopupAction;
class KTempFile;
namespace KTextEditor
{
class Mark;
class View;
}
struct DirInfo;
struct EventAction;
struct ToolbarEntry;
/**
* The base class for Quanta application windows.
*/
class QuantaApp : public KMdiMainFrm, public DCOPWindowManagerIf
{
Q_OBJECT
friend class QuantaInit;
public:
QuantaApp(int mdiMode);
~QuantaApp();
QuantaDoc *doc() const {return m_doc; }
TQPopupMenu *tagsMenu() const {return m_tagsMenu;}
TDEConfig *config() const {return m_config;}
//TODO: check if we really need these "get" methods (and get rid o get)
MessageOutput *messageOutput() const {return m_messageOutput;}
MessageOutput *problemOutput() const {return m_problemOutput;}
AnnotationOutput *annotationOutput() const {return m_annotationOutput;}
DebuggerManager *debugger() const {return m_debugger;}
KParts::PartManager *partManager() {return m_partManager;}
TQWidget* createContainer(TQWidget *parent, int index, const TQDomElement &element, int &id );
void removeContainer(TQWidget *container, TQWidget *parent, TQDomElement &element, int id );
/** Returns the project's base URL if it exists, the HOME dir if there is no project and no opened document (or the current opened document was not saved yet), and the base URL of the opened document, if it is saved somewhere.
maps to the same function in Project*/
KURL projectBaseURL() const;
/** Returns the project (if there is one loaded) or global default encoding. */
TQString defaultEncoding();
/** Returns the interface number for the currently active editor. */
int currentEditorIfNum() const;
/** Return the URL of the currently active document */
TQString currentURL() const;
/** Return the URL of the currently project */
TQString projectURL() const;
/** Return the list of opened URLs and their editor interface numbers*/
TQStringList openedURLs() const;
TQString saveCurrentFile();
/**
* Sets the DTEP for the current document.
* @param dtepName the name (nickname or full name) of the DTEP
* @param convert if true, converts the !DOCTYPE line to the new DTEP
*/
void setDtep(const TQString& dtepName, bool convert);
TQStringList tagAreas(const TQString& name, bool includeCoordinates, bool skipFoundContent) const;
TQString documentFolderForURL(const TQString &url);
TQString urlWithPreviewPrefix(const TQString &url);
void addFileToProject(const TQString &url);
void addFolderToProject(const TQString &url);
void uploadURL(const TQString &url, const TQString& profile, bool markOnly); /** Capture DCOP signals from KXsldbgPart or similar plugin */
void newCursorPosition(const TQString &file, int lineNumber, int columnNumber);
void newDebuggerPosition(const TQString &file, int lineNumber);
void openFile(const TQString &file, int lineNumber, int columnNumber);
/** reparse current document and initialize node. */
void reparse(bool force);
bool structTreeVisible() const;
bool previewVisible() const {return m_previewVisible;}
//return the old Cursor position
void oldCursorPos(uint &line, uint &col) {line = oldCursorLine; col = oldCursorCol;}
TQStringList selectors(const TQString& tag);
TQStringList idSelectors();
WHTMLPart *documentationPart() {return m_htmlPartDoc;}
/** Show the toolbar which is in url. If it was not loaded yet, it loads the
toolbar from the file */
void showToolbarFile(const KURL &url);
void setParserEnabled(bool enabled) {m_parserEnabled = enabled;}
/** tabs for left panel */
DocTreeView *dTab;
EnhancedTagAttributeTree *aTab;
/**
* Show a TagDialog of Node tag, with attrs attr.
* @param tag The name of the new Node to create.
* @param attr The string containing the attrs of the new Node to create.
* @return Returns a new Node created according to the contents of the TagDialog.
*/
Node *showTagDialogAndReturnNode(const TQString &tag, const TQString &attr = TQString());
/** Returns the baseURL of the document. */
KURL baseURL();
void startIdleTimer();
/** Called when a document was closed. Resets some variables. */
void slotFileClosed(Document *w);
void setTabToolTip(TQWidget *w, const TQString& toolTipStr);
void createPreviewPart();
void createDocPart();
/**
* This is a pool for actions waiting for being applied (VPL only yet).
* For example, whee a user presses the bold action, it isn't immediately applied on the document.
* If the user presses a key right away the character is inserted inside the tags for the queued actions.
* If the user changes the place of the cursor, the actions waiting for being inserted are removed.
*/
TQStringList const& tagActionPool() const {return m_tagActionPool;}
void insertTagActionPoolItem(TQString const& action_item);
void removeTagActionPoolItem(TQString const& action_item);
void removeAllTagActionPoolItems() {m_tagActionPool.clear();}
/** Updates the structure and attribute treeview. */
void updateTreeViews();
void setTitle(const TQString&);
TQPtrList<TagAction> const& tagActions() const {return m_tagActions;}
/** Clicked word or selected text for context sensitive menu in editor */
TQString popupWord;
signals: // Signals
/** signal used to hide the splash screen */
void showSplash(bool);
// trees need reload because hidden files option changed
void reloadAllTrees();
/** Emitted when some kind of event that can have associated actions has happened. */
void eventHappened(const TQString&, const TQString&, const TQString& );
void toolbarRemoved(const TQString&);
void showMessage(const TQString&, bool);
void clearMessages();
public slots:
void slotFileNew();
void slotFileOpen();
void slotFileOpen(const KURL &url);
void slotFileOpen(const KURL &url, const TQString &encoding);
void slotFileOpen(const KURL &url, const TQString &encoding, bool readOnly);
void slotFileOpen(const KURL::List &urls, const TQString& encoding);
void slotFileSave();
bool slotFileSaveAs(QuantaView *viewToSave = 0L);
void slotFileSaveAsLocalTemplate();
void slotFileSaveAsProjectTemplate();
void slotFileSaveSelectionAsLocalTemplate();
void slotFileSaveSelectionAsProjectTemplate();
void slotFileSaveAll();
void slotFileReload(QuantaView *view = 0L);
void slotFileReloadAll();
/** Close the document specified in the parameter if it's opened */
void slotFileClose(const KURL &url);
void slotFileCloseAll();
void slotFileQuit();
void slotOpenFileInPreview(const KURL &url);
void slotImageOpen(const KURL &url);
void slotFileOpenRecent(const KURL &url);
void slotInsertTag(const KURL&, DirInfo);
void slotEditFindInFiles();
/// open url in documentation window
void openDoc(const TQString& url);
void slotContextHelp();
void slotBack();
void slotForward();
void statusBarTimeout();
/** Shows the message in the status bar.
WARNING: Don't use in place where nothing should happen until the function
exits (like in startup code, DTD reading, etc.) as it calls processEvents() and
unexpected things may happen. */
void slotStatusMsg(const TQString &text);
void slotNewStatus();
void slotNewLineColumn();
// void slotUpdateStatus(TQWidget*);FIXME:
/** repaint preview */
void slotRepaintPreview();
/** toggles showing the preview */
void slotToggleShowPreview();
/** Shows the preview widget and repaints the preview or
hides the preview widget and restores the original document
*/
void slotShowPreviewWidget(bool show);
/** Called from the view manager when the status of the preview must change:
- hide if the preview was in the editor area
- update if the preview is in a toolview
*/
void slotChangePreviewStatus();
/** Called when the preview widget got or lost the focus */
void slotPreviewHasFocus(bool focus);
void slotShowMessagesView();
void slotShowProblemsView();
void slotShowAnnotationView();
void slotContextMenuAboutToShow();
/** options slots */
void slotShowMenuBar();
void slotPreviewOptions();
void slotOptions();
void slotOptionsConfigureKeys();
void slotOptionsConfigureToolbars();
void slotNewToolbarConfig();
/** Configure toolbars, show defaultToolbar by default */
void slotConfigureToolbars(const TQString& defaultToolbar = TQString());
void slotOptionsConfigureActions();
void setCursorPosition(int row, int col );
void gotoFileAndLine(const TQString& filename, int line, int column);
void selectArea(int line1, int col1, int line2, int col2);
/** Insert the content of the url into the current document. */
void slotInsertFile(const KURL& url);
/** Sends a toolbar in mail. */
void slotSendToolbar();
/** Removes a user toolbar from the toolbars. */
bool slotRemoveToolbar();
/** Adds a new, empty toolbar. */
void slotAddToolbar();
/** Saves a toolbar as local specific. */
void slotSaveLocalToolbar();
/** Saves a toolbar as project specific. */
void slotSaveProjectToolbar();
/** Loads the toolbars for dtd named dtdName and unload the ones belonging to oldDtdName. */
void slotLoadToolbarForDTD(const TQString& dtdName);
/** Load an user toolbar from the disk. */
void slotLoadToolbarFile(const KURL& url);
/** Load an user toolbar from the disk. */
void slotLoadToolbar();
/** Load a global toolbar from the disk. */
void slotLoadGlobalToolbar();
/** Remove the toolbar named "name". */
bool slotRemoveToolbar(const TQString& name);
/** Rename the toolbar named "name". */
void slotRenameToolbar(const TQString& name);
/** Rename the toolbar. */
void slotRenameToolbar();
/** Delete an action */
void slotDeleteAction(TDEAction *action);
/** Remove the action from toolbar*/
void slotRemoveAction(const TQString&, const TQString& actionName);
/** Edit the action */
void slotEditAction(const TQString&);
/** Creates a new, empty action */
void slotNewAction();
/** Creates a script action for a_scriptURL using the a_interpreter as the script
interpreter application */
void slotAssignActionToScript(const KURL&a_scriptURL, const TQString& a_interpreter);
/** Change the DTD/DTEP of the current document. */
void slotChangeDTD();
/** Edit a DTD/DTEP description. */
void slotEditDTD();
/** Called when the user explicetly requested the completion box.*/
void slotShowCompletion();
/** Called when the user explicetly requested the completion hint.*/
void slotShowCompletionHint();
/** Show or hide the groups for dtepName in the structure tree.
The special value of "clear" for dtepName means show groups
for all DTEPs found in the document.*/
void slotShowGroupsForDTEP(const TQString& dtepName, bool show);
/** Build the project specific toolbar menu. */
void slotBuildPrjToolbarsMenu();
void slotReparse();
void slotForceReparse();
void slotExpandAbbreviation();
/** Format the code of the document */
void slotCodeFormatting();
/** Show the Document Properties Dialog */
void slotDocumentProperties();
/** Show the Document Properties Dialog
* If forceInsertionOfMinimalTree and the user haven't modified something in the dialog,
* it will anyway insert a Minimal tree (HTML, BODY, ...)
*/
void documentProperties(bool forceInsertionOfMinimalTree = false);
/** No descriptions */
void slotAutosaveTimer();
void slotHideSplash() {emit showSplash(false);}
void slotConvertCase();
/** Reload the tree of the StructTreeView */
void slotReloadStructTreeView(bool groupOnly = false);
void slotReportBug();
/** registers a new part in the partmanager */
void slotNewPart(KParts::Part *newPart, bool setActiv);
void slotUploadFile(QuantaView *view=0L);
void slotDeleteFile(QuantaView *view=0L);
/** Called when the CVS command working on files was executed successfully. */
void slotCVSCommandExecuted(const TQString &command, const TQStringList &files);
/** Called when the preview or documentation part is deleted. */
void slotHTMLPartDeleted(TQObject *object);
void slotRefreshActiveWindow();
bool slotEnableIdleTimer(bool enable);
//Overridden KMdiMainFrm slots
virtual void closeAllViews();
virtual void closeActiveView();
virtual void switchToToplevelMode();
virtual void switchToChildframeMode();
virtual void switchToIDEAlMode();
virtual void switchToTabPageMode();
/** appends all visible user toolbar urls to the list */
void slotGetUserToolbarFiles(KURL::List *list);
// Get saved position of dock
KDockWidget::DockPosition prevDockPosition(TQWidget* dock, KDockWidget::DockPosition def);
protected slots:
void slotDockWidgetHasUndocked(KDockWidget *widget);
void slotPreviewBeingClosed();
/** Show or hide the DTD toolbar */
void slotToggleDTDToolbar(bool show);
/** Loads a DTEP*/
void slotLoadDTEP();
/** Sends a DTEP in email */
void slotEmailDTEP();
/** Downloads a DTEP from the main server */
void slotDownloadDTEP();
/** Uploads a DTEP to the main server */
void slotUploadDTEP();
/** Downloads a toolbar from the main server */
void slotDownloadToolbar();
/** Uploads a toolbar to the main server */
void slotUploadToolbar();
/** Enable/Disable Smart Tag Insertion */
void slotSmartTagInsertion();
/** Downloads a template from the main server */
void slotDownloadTemplate();
/** Uploads a template to the main server */
void slotUploadTemplate(const TQString &fileName);
/** Downloads a script from the main server */
void slotDownloadScript();
/** Uploads a script to the main server */
void slotUploadScript(const TQString &fileName);
/** Downloads a documentation from the main server */
void slotDownloadDoc();
/** Shows tip of the day */
void slotHelpTip();
void slotOpenFileUnderCursor();
void slotUploadOpenedFiles();
/** Called after there was no user activity - cursor movement - for xx ms*/
void slotIdleTimerExpired();
void slotShowNoFramesPreview();
/** Get script output */
void slotGetScriptOutput(TDEProcess*, char*, int);
/** Get script error */
void slotGetScriptError(TDEProcess*, char*, int);
/** Notify when process exits */
void slotProcessExited(TDEProcess*);
/** External app execution timeout handling */
void slotProcessTimeout();
/** connected to the part manager, activates a new part */
void slotActivePartChanged(KParts::Part * );
void slotTagMail();
void slotTagQuickList();
void slotTagEditTable();
void slotTagColor();
void slotTagDate();
void slotTagSelect();
/** Add the starting and closing text for a
user specified tag. */
void slotTagMisc();
void slotEditCurrentTag();
void slotSelectTagArea();
void slotSelectTagArea(Node *node);
void slotInsertCSS();
void slotFrameWizard();
void slotViewInKFM();
void slotViewInLynx();
void slotPasteHTMLQuoted();
void slotPasteURLEncoded();
void slotInsertChar();
//Edit
void slotUndo ();
void slotRedo ();
void slotCut();
void slotCopy();
void slotPaste();
void slotShowSourceEditor();
void slotShowVPLAndSourceEditor();
void slotShowVPLOnly();
void slotTabDragged(TQWidget *widget);
void slotTabMoved(int from, int to);
void slotTabAboutToMove(int from, int to);
void slotAnnotate();
protected:
/** Create a DTEP tarball which can be uploaded or sent in email. Returns
* the name of the created file or TQString() if creation has failed.
*/
TQString createDTEPTarball();
/** Create a toolbar tarball which can be uploaded or sent in email. Returns
* the name of the created file or TQString() if creation has failed.
*/
TQString createToolbarTarball();
/** Ask for save all the modified user toolbars. */
bool removeToolbars();
/** Returns true if all toolbars are hidden, false otherwise. */
bool allToolbarsHidden() const;
/** No descriptions */
virtual void focusInEvent(TQFocusEvent*);
void saveOptions();
virtual bool queryClose();
void saveAsTemplate (bool projectTemplate, bool selectionOnly = false);
/** Saves a toolbar as local or project specific. */
bool saveToolbar(bool localToolbar = true, const TQString& toolbarToSave = TQString(), const KURL& destURL = KURL());
/** Saves the toolbar and the actions. Returns the name of the actions file*/
KURL saveToolbarToFile(const TQString& toolbarName,const KURL& destFile);
/** Makes the tabwidget look and behave like we want. If closeButtonsOnly is true,
only the close button behavior is changed. */
void initTabWidget(bool closeButtonsOnly = false);
void dropEvent(TQDropEvent *ev);
void dragEnterEvent ( TQDragEnterEvent * );
void resetDockLayout();
ScriptTreeView *scriptTab;
private:
FilesTreeView *fTab;
ToolbarEntry *toolbarByURL(const KURL& url);
/** Message output window */
MessageOutput *m_messageOutput;
MessageOutput *m_problemOutput;
AnnotationOutput *m_annotationOutput;
KMdiToolViewAccessor* m_messageOutputView;
KMdiToolViewAccessor* m_problemsOutputView;
KMdiToolViewAccessor* m_annotationOutputView;
KMdiToolViewAccessor* m_previewToolView;
KMdiToolViewAccessor* m_documentationToolView;
Document *m_previewedDocument;
// Debugger
DebuggerManager *m_debugger;
QuantaPluginInterface *m_pluginInterface;
TQPopupMenu *m_tagsMenu;
// config
TDEConfig *m_config;
/** HTML class for preview */
WHTMLPart *m_htmlPart;
WHTMLPart *m_htmlPartDoc;
// DOC & VIEW
QuantaDoc *m_doc;
/** parsered tree of document */
TQTimer *statusbarTimer;
// ACTIONS
TDERecentFilesAction *projectToolbarFiles;
TDEToggleAction *showVPLAction, *showSourceAction, *showVPLSourceAction, *showDTDToolbar;
TDEToolBarPopupAction *showPreviewAction;
TDEAction *saveAction, *saveAllAction;
TDEAction *editTagAction, *selectTagAreaAction;
TQDomDocument* m_actions;
TQPtrList<KTextEditor::Mark> markList;
int currentPageIndex;
uint userToolbarsCount;
bool previewCopyMade;
KTempFile *previewTmpFile;
uint cursorLine;
uint cursorCol;
uint oldCursorLine;
uint oldCursorCol;
bool m_previewVisible;
bool m_noFramesPreview;
bool m_parserEnabled; ///< enables/disables reparsing. If false, even a forced reparse is ignored (used when opening multiple files)
TQString m_scriptOutput;
TQStringList m_tagActionPool;
TQPtrList<TagAction> m_tagActions;
protected: // Protected attributes
/** Timer to refresh the structure tree. */
TQTimer *refreshTimer;
/** Timer to detect idle periods. Every time the cursor moves the timer is
restarted.*/
TQTimer *idleTimer;
/** The toolbars for this DTD are currently shown to the user. */
TQString currentToolbarDTD;
KDockWidget *m_oldTreeViewWidget;
/** The ids of the widgets visible before doing the preview/documentation browsing */
TQValueList<int> previousWidgetList;
/* Store the old shortcuts from the local quantaui.rc */
TQMap<TQString, TQString> oldShortcuts;
KURL urlUnderCursor;
TQTimer *autosaveTimer;
DCOPSettings *dcopSettings;
DCOPQuanta *dcopQuanta;
KParts::PartManager *m_partManager; ///< the pointer to the part manager
TQGuardedPtr<KTextEditor::View> m_oldKTextEditor; ///< remembers the last activated GUI
QNewDTEPStuff *m_newDTEPStuff;
QNewToolbarStuff *m_newToolbarStuff;
QNewTemplateStuff *m_newTemplateStuff;
QNewScriptStuff *m_newScriptStuff;
QNewDocStuff *m_newDocStuff;
TQDict<ToolbarEntry> m_toolbarList;
public: //TODO: check if it's worth to make a read method for them
TDERecentFilesAction *fileRecent;
/** True when the whole quanta is initialized. */
bool quantaStarted;
bool m_loopStarted; //true if an internal event loop has been started
bool m_idleTimerEnabled;
QuantaInit *m_quantaInit; ///< the pointer to all the init stuff
};
#endif // QUANTA_H
|