summaryrefslogtreecommitdiffstats
path: root/kxsldbg/kxsldbgpart/xsldbgdebugger.h
blob: 886f16352de2ce039c7bf7cc67145633179a787b (plain)
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
/***************************************************************************
                          xsldbgdebugger.h  -  description
                             -------------------
    begin                : Tue Jan 1 2002
    copyright            : (C) 2002 by keith Isdale
    email                : k_isdale@tpg.com.au
 ***************************************************************************/

/***********************************************************************************
 *                                                                         										*
 *   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 XSLDBGDEBUGGER_H
#define XSLDBGDEBUGGER_H

#include <tqevent.h>
#include "libxsldbg/xsldbgmsg.h"   /* needed for XsldbgMessageEnum */
#include "libtqtnotfier/xsldbgdebuggerbase.h"

#include "xsldbginspector.h"


/**
  *@author Keith Isdale
  */

class TQStringList;

class XsldbgWalkSpeedImpl;

class XsldbgDebugger : public XsldbgDebuggerBase {
  TQ_OBJECT
  

public:
	XsldbgDebugger();
	~XsldbgDebugger();

	/** */
	void setInspector(XsldbgInspector *inspector);

	/** Get the name of source file from xsldbg*/
	TQString sourceFileName();

	/** Get the name of data file from xsldbg*/
	TQString dataFileName();

	/** Get the name of output file from xsldbg*/
	TQString outputFileName();

	/** Tell quanta to move its cursor to file and line number supplied */
	void gotoLine(TQString fileName, int lineNo, bool breakpoint = false);

	/** Set a xsldbg option */
	void setOption(const char *name, bool value);

	bool event(TQEvent *e);
	void timerEvent(TQTimerEvent *e);

	void setOutputFileActive(bool b) {outputFileActive = b;};

	/* helper function to handle differences between URI's in TQt/KDE and libxml2 */
	static TQString fixLocalPaths(TQString & file);
	
private:
	/** */
	bool outputFileActive;

public slots:
	/** start xsldbg */
	bool start();

	/** stop xsldbg */
	bool stop();

	/** send text to xsldbg, if wait is true then wait for the reply */
	void fakeInput(TQString text, bool wait);

	/** Display configure dialog */
	void slotConfigure();

	/** Config window closed */
	void slotConfigClosed();

  /** Step to next instruction */
  void slotStepCmd();

  /** Continue to next break point */
  void slotContinueCmd();

  /** Restart xsldbg with selected xsl/xml file */
  void slotRunCmd();

  /** Walk throught shtylesheet at a fixed speed
  	 @param speed : Must be a value of 0  to 9, where 1 mean fast, 9 means slow, and 0 means stop
  */
  void slotWalkSpeed(int speed);

  /** Present a dialog for use to choose walk speed */
  void slotWalkCmd();

  /** Stop walking imediately */
  void slotWalkStopCmd();

  /**
  	Start xslbg's trace mode, where output will be sent to to message window.
  		Can only be be stopped by using "exit" tool button and killing xsldbg */
  void slotTraceCmd();

	/** Add breakpoint at given file and line number */
	void slotBreakCmd(TQString fileName, int lineNumber);

	/** Add breakpoint at given template name*/
	void slotBreakCmd(TQString templateName, TQString modeName);

	/** Toggle the enabling of break point at given file and line number */
	void slotEnableCmd(TQString fileName, int lineNumber);

	/** Enable break point for given breakpoint id */
	void slotEnableCmd(int id);

	/** Delete break point at given file and line number */
	void slotDeleteCmd(TQString fileName, int lineNumber);

	/** Delete break point for given breakpoint id */
	void slotDeleteCmd(int id);

	/** Switch to view of XSL source */
	void slotSourceCmd();

	/* switch to the output document  */
	void slotShowDocument();

	/** Switch to view of XML data */
	void slotDataCmd();

  /** Stop xsldg, must use start after this command  */
  void slotExitCmd();

  /** Print the result of evaluating xPathExpression to the message window */
  void slotCatCmd(TQString xPathExpression);

  /** Move to line specified by xPathExpression */
  void slotCdCmd(TQString xPathExpression);

  /** Set a libxslt variable  to  xPathExpression */
  void slotSetVariableCmd(TQString variableName, TQString xPathExpression);
signals: // Signals
    // generated after first message is received from xsldbg
    void debuggerReady();

private:
	bool initialized;

	 /* xsldbg config and inspection dialog */
	XsldbgInspector *inspector;

	/**Walk speed dialog  */
	XsldbgWalkSpeedImpl *walkDialog;
	bool readMsg;
	bool procMsg;

	/* copy text to output only if no furher output us requested */
	XsldbgMessageEnum lastType;
	int updateTimerID;
	bool addMsg;

	TQStringList commandQue;

};

#endif