Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement multi-tab feature in TabManager class #2955

Open
wants to merge 36 commits into
base: master
from
Open
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
7502652
Implement multi-tab feature in TabManager class
RomitKumar May 26, 2019
8086470
Integrate support for legacy and scintilla editor along
RomitKumar May 28, 2019
c9b76a7
Implement pre-available editing features for each tab
RomitKumar May 28, 2019
cfa32da
remove support for legacy editor
RomitKumar May 29, 2019
1ad0f53
corrected keyboard shortcut for zoom-in and zoom-out
RomitKumar May 29, 2019
a60542f
undoState and windowModified updates for each tab
RomitKumar May 30, 2019
0b1427d
Correct stl export and parameterWidget enable state behaviour
RomitKumar Jun 1, 2019
a2a0da5
update to enable Scintilla Editor in travis check
RomitKumar Jun 1, 2019
cb2d2d6
Customizer widget disables on changing tab
RomitKumar Jun 1, 2019
b7e4d80
animation stops on changing tab
RomitKumar Jun 1, 2019
6bc13c5
remove commented lines
RomitKumar Jun 1, 2019
23129ba
Extended Find, Find and Replace behaviour for multi-tab
RomitKumar Jun 4, 2019
d594980
Removed support for single file QScintilla Editor
RomitKumar Jun 6, 2019
396d75b
Add the feature of New Tab
RomitKumar Jun 9, 2019
ee26a80
Correct the new tab implementation
RomitKumar Jun 9, 2019
486562d
Implement open file in new tab
RomitKumar Jun 9, 2019
232844b
Recent file and examples open in new tab
RomitKumar Jun 9, 2019
0ea2735
Handle file drop for multi-tab
RomitKumar Jun 9, 2019
c73a63a
Implement close confirmation dialog for unsaved tab and window
RomitKumar Jun 9, 2019
6a0a1d1
Changed behaviour of option in file menu
RomitKumar Jun 11, 2019
e3ff4d9
Corrected open behaviour for file drops
RomitKumar Jun 11, 2019
0e92308
Code cleanup, renaming of function and variable names
RomitKumar Jun 13, 2019
cdaee5e
Cleanup of Code
RomitKumar Jun 13, 2019
b0c95e8
Implement the feature of Save All
RomitKumar Jun 14, 2019
35e3fe0
Parameter Widget enabled on file load
RomitKumar Jun 14, 2019
acc3123
Recent File and example open in empty tab
RomitKumar Jun 14, 2019
087359f
Tab Header spans whole width of screen
RomitKumar Jun 16, 2019
c59df44
Update openscad.pro file
RomitKumar Jun 16, 2019
fd93e57
Add Tab Header in ToolBar
RomitKumar Jun 17, 2019
a50fd61
Corrected the opening of tab in toolbar
RomitKumar Jun 17, 2019
689292c
Undocked editor contains tab header toolbar
RomitKumar Jun 17, 2019
dff9b9b
Tab tool bar hidden for single tab
RomitKumar Jun 21, 2019
12c605f
Corrected implementation of opening of file in empty editor tab
RomitKumar Jul 13, 2019
30085ff
Corrected interpretation of ampersand in file name
RomitKumar Jul 13, 2019
a99d689
Merge branch 'master' into multi-tab
RomitKumar Jul 14, 2019
606f743
initialized tabCount variable
RomitKumar Jul 20, 2019
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Cleanup of Code

This commit includes removing unhelpful comment statements, correcting the implementation of Reload, remove mdi checkbox from Preferences/Advanced, discarded redundant functions openFile() and setFileName() from MainWindows, prevent double emmission of currentChanged signal for first tab.
  • Loading branch information...
RomitKumar committed Jun 13, 2019
commit cdaee5ea6d226efb963b9f38a839fc74e6cad911
@@ -37,7 +37,6 @@ class MainWindow : public QMainWindow, public Ui::MainWindow, public InputEventH
int anim_dump_start_step;

QTimer *autoReloadTimer;
std::string autoReloadId;
QTimer *waitAfterReloadTimer;
QTime renderingTime;
EditorInterface *customizerEditor;
@@ -50,6 +49,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindow, public InputEventH
AbstractNode *root_node; // Root if the root modifier (!) is used
Tree tree;
EditorInterface *activeEditor;
TabManager *tabManager;

#ifdef ENABLE_CGAL
shared_ptr<const class Geometry> root_geom;
@@ -73,7 +73,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindow, public InputEventH
int compileErrors;
int compileWarnings;

MainWindow(const QString &filename);
MainWindow(const QStringList &filenames);
~MainWindow();

protected:
@@ -85,10 +85,8 @@ private slots:
void updatedAnimSteps();
void updatedAnimDump(bool checked);
void updateTVal();
void updateMdiMode(bool mdi);
void updateUndockMode(bool undockMode);
void updateReorderMode(bool reorderMode);
void setFileName(const QString &filename);
void setFont(const QString &family, uint size);
void setColorScheme(const QString &cs);
void showProgress();
@@ -99,18 +97,17 @@ private slots:
static void consoleOutput(const std::string &msg, void *userdata);
static void noOutput(const std::string &, void*) {}; // /dev/null

bool fileChangedOnDisk();

private:
void initActionIcon(QAction *action, const char *darkResource, const char *lightResource);
void handleFileDrop(const QString &filename);
void refreshDocument();
void updateCamera(const class FileContext &ctx);
void updateTemporalVariables();
bool fileChangedOnDisk();
void parseTopLevelDocument(bool rebuildParameterWidget);
void updateCompileResult();
void compile(bool reload, bool forcedone = false, bool rebuildParameterWidget=true);
void compileCSG();
//bool maybeSave();
void saveError(const QIODevice &file, const std::string &msg);
bool checkEditorModified();
QString dumpCSGTree(AbstractNode *root);
@@ -126,8 +123,6 @@ private slots:
void updateStatusBar(class ProgressWidget *progressWidget);
void exceptionCleanup();

TabManager *tabManager;

class LibraryInfoDialog* library_info_dialog;
class FontListDialog *font_list_dialog;

@@ -235,7 +230,6 @@ private slots:
QList<double> getRotation() const;

public slots:
void openFile(const QString &filename);
void actionReloadRenderPreview();
void on_editorDock_visibilityChanged(bool);
void on_consoleDock_visibilityChanged(bool);
@@ -290,7 +284,6 @@ public slots:
private:
bool network_progress_func(const double permille);
static void report_func(const class AbstractNode*, void *vp, int mark);
static bool mdiMode;
static bool undockMode;
static bool reorderMode;
static const int tabStopWidth;
@@ -312,7 +305,6 @@ public slots:
time_t includes_mtime; // latest include mod time
time_t deps_mtime; // latest dependency mod time
std::unordered_map<std::string, QString> export_paths; // for each file type, where it was exported to last
void clearExportPaths(); // clear exports paths when main file is changed by open, new, etc.
QString exportPath(const char *suffix); // look up the last export path and generate one if not found
int last_parser_error_pos; // last highlighted error position

@@ -652,16 +652,9 @@
</property>
</action>
<action name="fileActionNewWindow">
<!-- <property name="icon">
<iconset resource="../openscad.qrc">
<normaloff>:/images/blackNew.png</normaloff>:/images/blackNew.png</iconset>
</property> -->
<property name="text">
<string>New Window</string>
</property>
<!-- <property name="shortcut">
<string>Ctrl+N</string>
</property> -->
</action>
<action name="fileActionOpen">
<property name="icon">
@@ -676,16 +669,9 @@
</property>
</action>
<action name="fileActionOpenWindow">
<!-- <property name="icon">
<iconset resource="../openscad.qrc">
<normaloff>:/images/Open-32.png</normaloff>:/images/Open-32.png</iconset>
</property> -->
<property name="text">
<string>Open in New Window</string>
</property>
<!-- <property name="shortcut">
<string>Ctrl+O</string>
</property> -->
</action>
<action name="fileActionSave">
<property name="icon">
@@ -73,13 +73,13 @@ void OpenSCADApp::requestOpenFile(const QString &filename)
for (auto win : this->windowManager.getWindows()) {
// if we have an empty open window, use that one
if (win->isEmpty()) {
win->openFile(filename);
win->tabManager->createTab(filename);
return;
}
}

// ..otherwise, create a new one
new MainWindow(filename);
new MainWindow(QStringList(filename));
}

void OpenSCADApp::showFontCacheDialog()
@@ -155,7 +155,6 @@ void Preferences::init() {
#endif
this->defaultmap["advanced/openCSGLimit"] = RenderSettings::inst()->openCSGTermLimit;
this->defaultmap["advanced/forceGoldfeather"] = false;
this->defaultmap["advanced/mdi"] = true;
this->defaultmap["advanced/undockableWindows"] = false;
this->defaultmap["advanced/reorderWindows"] = true;
this->defaultmap["launcher/showOnStartup"] = true;
@@ -430,14 +429,6 @@ void Preferences::on_checkNowButton_clicked()
}
}

void
Preferences::on_mdiCheckBox_toggled(bool state)
{
QSettingsCached settings;
settings.setValue("advanced/mdi", state);
emit updateMdiMode(state);
}

void
Preferences::on_reorderCheckBox_toggled(bool state)
{
@@ -889,7 +880,6 @@ void Preferences::updateGUI()
this->localizationCheckBox->setChecked(getValue("advanced/localization").toBool());
this->autoReloadRaiseCheckBox->setChecked(getValue("advanced/autoReloadRaise").toBool());
this->forceGoldfeatherBox->setChecked(getValue("advanced/forceGoldfeather").toBool());
this->mdiCheckBox->setChecked(getValue("advanced/mdi").toBool());
this->reorderCheckBox->setChecked(getValue("advanced/reorderWindows").toBool());
this->undockCheckBox->setChecked(getValue("advanced/undockableWindows").toBool());
this->undockCheckBox->setEnabled(this->reorderCheckBox->isChecked());
@@ -983,8 +973,6 @@ void Preferences::apply_win() const
{
emit requestRedraw();
emit openCSGSettingsChanged();
// emit fontChanged(getValue("editor/fontfamily").toString(), getValue("editor/fontsize").toUInt());
// emit syntaxHighlightChanged(getValue("editor/syntaxhighlight").toString());
}

void Preferences::create(QStringList colorSchemes)
@@ -42,7 +42,6 @@ public slots:
void on_autoReloadRaiseCheckBox_toggled(bool);
void on_updateCheckBox_toggled(bool);
void on_snapshotCheckBox_toggled(bool);
void on_mdiCheckBox_toggled(bool);
void on_reorderCheckBox_toggled(bool);
void on_undockCheckBox_toggled(bool);
void on_checkNowButton_clicked();
@@ -95,7 +94,6 @@ public slots:

signals:
void requestRedraw() const;
void updateMdiMode(bool mdi) const;
void updateUndockMode(bool undockMode) const;
void updateReorderMode(bool undockMode) const;
void fontChanged(const QString &family, uint size) const;
@@ -1606,13 +1606,6 @@
<string>User Interface</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_13">
<item>
<widget class="QCheckBox" name="mdiCheckBox">
<property name="text">
<string>Allow opening multiple documents</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="reorderCheckBox">
<property name="text">
@@ -59,4 +59,5 @@ public slots:
bool contentsRendered; // Set if the source code has changes since the last render (F6)
int findState;
QString filepath;
std::string autoReloadId;
};
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.