work save
This commit is contained in:
parent
2339f66d4a
commit
e269e7c747
|
@ -33,8 +33,9 @@ void Debugger::start()
|
|||
tr("Can''t find debugger in : \"%1\"").arg(debuggerPath));
|
||||
return;
|
||||
}
|
||||
mReader = std::make_shared<DebugReader>();
|
||||
mReader = new DebugReader(this);
|
||||
mReader->setDebuggerPath(debuggerPath);
|
||||
connect(mReader, &QThread::finished,this,&Debugger::stop);
|
||||
mReader->start();
|
||||
|
||||
|
||||
|
@ -52,7 +53,7 @@ void Debugger::start()
|
|||
//Reader.Resume;
|
||||
//Reader.OnInvalidateAllVars := OnInvalidateAllVars;
|
||||
|
||||
//MainForm.UpdateAppTitle;
|
||||
pMainWindow->updateAppTitle();
|
||||
|
||||
//Application.HintHidePause := 5000;
|
||||
}
|
||||
|
@ -61,27 +62,22 @@ void Debugger::stop()
|
|||
{
|
||||
if (mExecuting) {
|
||||
mExecuting = false;
|
||||
if WatchVarList.Count = 0 then // nothing worth showing, restore view
|
||||
MainForm.LeftPageControl.ActivePageIndex := LeftPageIndexBackup;
|
||||
|
||||
// Close CPU window
|
||||
if Assigned(CPUForm) then
|
||||
CPUForm.Close;
|
||||
//stop debugger
|
||||
mReader->stopDebug();
|
||||
mReader->deleteLater();
|
||||
mReader=nullptr;
|
||||
// if WatchVarList.Count = 0 then // nothing worth showing, restore view
|
||||
// MainForm.LeftPageControl.ActivePageIndex := LeftPageIndexBackup;
|
||||
|
||||
// stop gdb
|
||||
TerminateProcess(fProcessID, 0);
|
||||
|
||||
Reader.Terminate;
|
||||
Reader := nil;
|
||||
// // Close CPU window
|
||||
// if Assigned(CPUForm) then
|
||||
// CPUForm.Close;
|
||||
|
||||
// Free resources
|
||||
CloseHandle(fProcessID);
|
||||
CloseHandle(fOutputRead);
|
||||
CloseHandle(fInputWrite);
|
||||
pMainWindow->removeActiveBreakpoints();
|
||||
|
||||
MainForm.RemoveActiveBreakpoints;
|
||||
|
||||
MainForm.UpdateAppTitle;
|
||||
pMainWindow->updateAppTitle();
|
||||
|
||||
MainForm.OnBacktraceReady;
|
||||
|
||||
|
|
|
@ -126,7 +126,6 @@ public:
|
|||
explicit Debugger(QObject *parent = nullptr);
|
||||
// Play/pause
|
||||
void start();
|
||||
void stop();
|
||||
void sendCommand(const QString& command, const QString& params,
|
||||
bool updateWatch = true,
|
||||
bool showInConsole = false,
|
||||
|
@ -147,7 +146,8 @@ public:
|
|||
|
||||
BacktraceModel* backtraceModel();
|
||||
BreakpointModel* breakpointModel();
|
||||
|
||||
public slots:
|
||||
void stop();
|
||||
signals:
|
||||
|
||||
private:
|
||||
|
@ -162,7 +162,7 @@ private:
|
|||
BreakpointModel* mBreakpointModel;
|
||||
bool mUseUTF8;
|
||||
BacktraceModel* mBacktraceModel;
|
||||
PDebugReader mReader;
|
||||
DebugReader* mReader;
|
||||
};
|
||||
|
||||
class DebugReader : public QThread
|
||||
|
|
|
@ -57,8 +57,9 @@ Editor::Editor(QWidget *parent, const QString& filename,
|
|||
mInProject(inProject),
|
||||
mIsNew(isNew),
|
||||
mSyntaxErrorColor(QColorConstants::Red),
|
||||
mSyntaxWaringColor("orange"),
|
||||
mLineCount(0)
|
||||
mSyntaxWarningColor("orange"),
|
||||
mLineCount(0),
|
||||
mActiveBreakpointLine(-1)
|
||||
{
|
||||
if (mFilename.isEmpty()) {
|
||||
newfileCount++;
|
||||
|
@ -373,7 +374,9 @@ void Editor::onGutterPaint(QPainter &painter, int aLine, int X, int Y)
|
|||
return;
|
||||
}
|
||||
|
||||
if (hasBreakpoint(aLine)) {
|
||||
if (mActiveBreakpointLine == aLine) {
|
||||
painter.drawPixmap(X,Y,*(pIconsManager->activeBreakpoint()));
|
||||
} else if (hasBreakpoint(aLine)) {
|
||||
painter.drawPixmap(X,Y,*(pIconsManager->breakpoint()));
|
||||
}
|
||||
// if fActiveLine = Line then begin // prefer active line over breakpoints
|
||||
|
@ -432,7 +435,7 @@ void Editor::onGetEditingAreas(int Line, SynEditingAreaList &areaList)
|
|||
if (issue->issueType == CompileIssueType::Error) {
|
||||
p->color = mSyntaxErrorColor;
|
||||
} else {
|
||||
p->color = mSyntaxWaringColor;
|
||||
p->color = mSyntaxWarningColor;
|
||||
}
|
||||
p->type = SynEditingAreaType::eatWaveUnderLine;
|
||||
areaList.append(p);
|
||||
|
@ -442,7 +445,20 @@ void Editor::onGetEditingAreas(int Line, SynEditingAreaList &areaList)
|
|||
|
||||
bool Editor::onGetSpecialLineColors(int Line, QColor &foreground, QColor &backgroundColor)
|
||||
{
|
||||
|
||||
if (Line == mActiveBreakpointLine) {
|
||||
foreground = mActiveBreakpointForegroundColor;
|
||||
backgroundColor = mActiveBreakpointBackgroundColor;
|
||||
} else if (hasBreakpoint(Line)) {
|
||||
foreground = mBreakpointForegroundColor;
|
||||
backgroundColor = mBreakpointBackgroundColor;
|
||||
}
|
||||
// end else if Line = fErrorLine then begin
|
||||
// StrToThemeColor(tc, devEditor.Syntax.Values[cErr]);
|
||||
// BG := tc.Background;
|
||||
// FG := tc.Foreground;
|
||||
// if (BG <> clNone) or (FG<>clNone) then
|
||||
// Special := TRUE;
|
||||
// end;
|
||||
}
|
||||
|
||||
void Editor::copyToClipboard()
|
||||
|
@ -1196,6 +1212,16 @@ bool Editor::hasBreakpoint(int line)
|
|||
return mBreakpointLines.contains(line);
|
||||
}
|
||||
|
||||
void Editor::removeBreakpointFocus()
|
||||
{
|
||||
if (mActiveBreakpointLine!=-1) {
|
||||
int oldLine = mActiveBreakpointLine;
|
||||
mActiveBreakpointLine = -1;
|
||||
invalidateGutterLine(oldLine);
|
||||
invalidateLine(oldLine);
|
||||
}
|
||||
}
|
||||
|
||||
void Editor::applySettings()
|
||||
{
|
||||
SynEditorOptions options = eoAltSetsColumnMode |
|
||||
|
@ -1272,6 +1298,24 @@ void Editor::applyColorScheme(const QString& schemeName)
|
|||
if (item) {
|
||||
codeFolding().indentGuidesColor = item->foreground();
|
||||
}
|
||||
item = pColorManager->getItem(schemeName,COLOR_SCHEME_ERROR);
|
||||
if (item) {
|
||||
this->mSyntaxErrorColor = item->foreground();
|
||||
}
|
||||
item = pColorManager->getItem(schemeName,COLOR_SCHEME_WARNING);
|
||||
if (item) {
|
||||
this->mSyntaxWarningColor = item->foreground();
|
||||
}
|
||||
item = pColorManager->getItem(schemeName,COLOR_SCHEME_ACTIVE_BREAKPOINT);
|
||||
if (item) {
|
||||
this->mActiveBreakpointForegroundColor = item->foreground();
|
||||
this->mActiveBreakpointBackgroundColor = item->background();
|
||||
}
|
||||
item = pColorManager->getItem(schemeName,COLOR_SCHEME_BREAKPOINT);
|
||||
if (item) {
|
||||
this->mBreakpointForegroundColor = item->foreground();
|
||||
this->mBreakpointBackgroundColor = item->foreground();
|
||||
}
|
||||
this->invalidate();
|
||||
}
|
||||
|
||||
|
|
|
@ -111,6 +111,7 @@ public:
|
|||
int gutterClickedLine() const;
|
||||
void toggleBreakpoint(int line);
|
||||
bool hasBreakpoint(int line);
|
||||
void removeBreakpointFocus();
|
||||
|
||||
signals:
|
||||
|
||||
|
@ -147,11 +148,16 @@ private:
|
|||
bool mIsNew;
|
||||
QMap<int,PSyntaxIssueList> mSyntaxIssues;
|
||||
QColor mSyntaxErrorColor;
|
||||
QColor mSyntaxWaringColor;
|
||||
QColor mSyntaxWarningColor;
|
||||
QColor mActiveBreakpointForegroundColor;
|
||||
QColor mActiveBreakpointBackgroundColor;
|
||||
QColor mBreakpointForegroundColor;
|
||||
QColor mBreakpointBackgroundColor;
|
||||
int mSyntaxErrorLine;
|
||||
int mLineCount;
|
||||
int mGutterClickedLine;
|
||||
QSet<int> mBreakpointLines;
|
||||
int mActiveBreakpointLine;
|
||||
|
||||
// QWidget interface
|
||||
protected:
|
||||
|
|
|
@ -146,6 +146,23 @@ bool EditorList::isFileOpened(const QString &name)
|
|||
return false;
|
||||
}
|
||||
|
||||
int EditorList::pageCount()
|
||||
{
|
||||
return mLeftPageWidget->count()+mRightPageWidget->count();
|
||||
}
|
||||
|
||||
Editor *EditorList::operator[](int index)
|
||||
{
|
||||
if (index>=0 && index<mLeftPageWidget->count()) {
|
||||
return static_cast<Editor*>(mLeftPageWidget->widget(index));
|
||||
}
|
||||
index -= mLeftPageWidget->count();
|
||||
if (index>=0 && index<mRightPageWidget->count()) {
|
||||
return static_cast<Editor*>(mRightPageWidget->widget(index));
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool EditorList::closeAll(bool force) {
|
||||
beginUpdate();
|
||||
auto end = finally([this] {
|
||||
|
|
|
@ -41,6 +41,9 @@ public:
|
|||
void applySettings();
|
||||
void applyColorSchemes(const QString& name);
|
||||
bool isFileOpened(const QString& name);
|
||||
int pageCount();
|
||||
|
||||
Editor* operator[](int index);
|
||||
|
||||
private:
|
||||
QTabWidget* getNewEditorPageControl() const;
|
||||
|
|
|
@ -7,7 +7,7 @@ IconsManager::IconsManager(QObject *parent) : QObject(parent)
|
|||
mSyntaxError = std::make_shared<QPixmap>(":/icons/images/editor/syntaxerror.png");
|
||||
mSyntaxWarning = std::make_shared<QPixmap>(":/icons/images/editor/syntaxwarning.png");
|
||||
mBreakpoint = std::make_shared<QPixmap>(":/icons/images/editor/breakpoint.png");
|
||||
mCurrentLine = std::make_shared<QPixmap>(":/icons/images/editor/currentline.png");
|
||||
mActiveBreakpoint = std::make_shared<QPixmap>(":/icons/images/editor/currentline.png");
|
||||
}
|
||||
|
||||
PIcon IconsManager::syntaxError() const
|
||||
|
@ -25,7 +25,7 @@ PIcon IconsManager::breakpoint() const
|
|||
return mBreakpoint;
|
||||
}
|
||||
|
||||
PIcon IconsManager::currentLine() const
|
||||
PIcon IconsManager::activeBreakpoint() const
|
||||
{
|
||||
return mCurrentLine;
|
||||
return mActiveBreakpoint;
|
||||
}
|
||||
|
|
|
@ -18,14 +18,14 @@ public:
|
|||
|
||||
PIcon breakpoint() const;
|
||||
|
||||
PIcon currentLine() const;
|
||||
PIcon activeBreakpoint() const;
|
||||
|
||||
signals:
|
||||
private:
|
||||
PIcon mSyntaxError;
|
||||
PIcon mSyntaxWarning;
|
||||
PIcon mBreakpoint;
|
||||
PIcon mCurrentLine;
|
||||
PIcon mActiveBreakpoint;
|
||||
};
|
||||
|
||||
extern IconsManager* pIconsManager;
|
||||
|
|
|
@ -207,6 +207,60 @@ void MainWindow::applySettings()
|
|||
this->setFont(font);
|
||||
}
|
||||
|
||||
void MainWindow::removeActiveBreakpoints()
|
||||
{
|
||||
for (int i=0;i<mEditorList->pageCount();i++) {
|
||||
Editor* e= (*mEditorList)[i];
|
||||
e->removeBreakpointFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::updateAppTitle()
|
||||
{
|
||||
appName := Lang[ID_DEVCPP];
|
||||
e := fEditorList.GetEditor;
|
||||
if Assigned(e) and not e.InProject then begin
|
||||
if e.Text.Modified then
|
||||
str := e.FileName + ' [*]'
|
||||
else
|
||||
str := e.FileName;
|
||||
if fDebugger.Executing then begin
|
||||
Caption := Format('%s - [Debugging] - %s %s', [str, appName, DEVCPP_VERSION]);
|
||||
Application.Title := Format('%s - [Debugging] - %s', [ExtractFileName(e.FileName), appName]);
|
||||
end else if devExecutor.Running then begin
|
||||
Caption := Format('%s - [Executing] - %s %s', [str, appName, DEVCPP_VERSION]);
|
||||
Application.Title := Format('%s - [Executing] - %s', [ExtractFileName(e.FileName), appName]);
|
||||
end else if fCompiler.Compiling then begin
|
||||
Caption := Format('%s - [Compiling] - %s %s', [str, appName, DEVCPP_VERSION]);
|
||||
Application.Title := Format('%s - [Compiling] - %s', [ExtractFileName(e.FileName), appName]);
|
||||
end else begin
|
||||
Caption := Format('%s - %s %s', [str, appName, DEVCPP_VERSION]);
|
||||
Application.Title := Format('%s - %s', [ExtractFileName(e.FileName), appName]);
|
||||
end;
|
||||
end else if Assigned(fProject) then begin
|
||||
if fDebugger.Executing then begin
|
||||
Caption := Format('%s - [%s] - [Debugging] - %s %s',
|
||||
[fProject.Name, ExtractFilename(fProject.Filename), appName, DEVCPP_VERSION]);
|
||||
Application.Title := Format('%s - [Debugging] - %s', [fProject.Name, appName]);
|
||||
end else if devExecutor.Running then begin
|
||||
Caption := Format('%s - [%s] - [Executing] - %s %s',
|
||||
[fProject.Name, ExtractFilename(fProject.Filename), appName, DEVCPP_VERSION]);
|
||||
Application.Title := Format('%s - [Executing] - %s', [fProject.Name, appName]);
|
||||
end else if fCompiler.Compiling then begin
|
||||
Caption := Format('%s - [%s] - [Compiling] - %s %s',
|
||||
[fProject.Name, ExtractFilename(fProject.Filename), appName, DEVCPP_VERSION]);
|
||||
Application.Title := Format('%s - [Compiling] - %s', [fProject.Name, appName]);
|
||||
end else begin
|
||||
Caption := Format('%s - [%s] - %s %s',
|
||||
[fProject.Name, ExtractFilename(fProject.Filename), appName, DEVCPP_VERSION]);
|
||||
Application.Title := Format('%s - %s', [fProject.Name, appName]);
|
||||
end;
|
||||
end else begin
|
||||
Caption := Format('%s %s', [appName, DEVCPP_VERSION]);
|
||||
Application.Title := Format('%s', [DEVCPP]);
|
||||
end;
|
||||
}
|
||||
|
||||
void MainWindow::updateStatusbarForLineCol()
|
||||
{
|
||||
Editor* e = mEditorList->getEditor();
|
||||
|
|
|
@ -58,6 +58,9 @@ public:
|
|||
|
||||
void applySettings();
|
||||
|
||||
void removeActiveBreakpoints();
|
||||
void updateAppTitle();
|
||||
|
||||
protected:
|
||||
void openFiles(const QStringList& files);
|
||||
void openFile(const QString& filename);
|
||||
|
|
Loading…
Reference in New Issue