Skip to content

Commit

Permalink
save state of printer axis expander, too
Browse files Browse the repository at this point in the history
  • Loading branch information
hurzl committed Aug 31, 2012
1 parent 2e6e533 commit 936f1ba
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 13 deletions.
23 changes: 11 additions & 12 deletions src/repsnapper.ui
Expand Up @@ -13,16 +13,6 @@
<property name="short_label">Calibrate</property>
<property name="tooltip">An interactive calibration routine</property>
</object>
<object class="GtkAction" id="Fullscreen">
<property name="label">Fullscreen</property>
<property name="short_label" translatable="yes">Fullscreen</property>
<property name="tooltip">Toggle Fullscreen</property>
</object>
<object class="GtkAction" id="LoadSettings">
<property name="label" translatable="yes">Load Settings</property>
<property name="short_label" translatable="yes">Load Settings</property>
<property name="tooltip" translatable="yes">Load application settings profile</property>
</object>
<object class="GtkAction" id="OpenGCode">
<property name="label" translatable="yes">Load _GCode</property>
<property name="short_label" translatable="yes">Load GCode</property>
Expand Down Expand Up @@ -79,6 +69,16 @@
<property name="step_increment">0.10000000000000001</property>
<property name="page_increment">10</property>
</object>
<object class="GtkAction" id="Fullscreen">
<property name="label">Fullscreen</property>
<property name="short_label" translatable="yes">Fullscreen</property>
<property name="tooltip">Toggle Fullscreen</property>
</object>
<object class="GtkAction" id="LoadSettings">
<property name="label" translatable="yes">Load Settings</property>
<property name="short_label" translatable="yes">Load Settings</property>
<property name="tooltip" translatable="yes">Load application settings profile</property>
</object>
<object class="GtkWindow" id="PrinterControlWindowTest">
<property name="can_focus">False</property>
<property name="default_width">200</property>
Expand Down Expand Up @@ -2738,10 +2738,9 @@ and others I forgot... (needs updating)</property>
</packing>
</child>
<child>
<object class="GtkExpander" id="expander1">
<object class="GtkExpander" id="printeraxis_expander">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="expanded">True</property>
<child>
<object class="GtkVBox" id="i_axis_controls">
<property name="visible">True</property>
Expand Down
6 changes: 6 additions & 0 deletions src/settings.cpp
Expand Up @@ -692,9 +692,11 @@ void Settings::load_settings (Glib::RefPtr<Gio::File> file)
try {
Misc.ExpandLayerDisplay = cfg.get_boolean ("Misc", "ExpandLayerDisplay");
Misc.ExpandModelDisplay = cfg.get_boolean ("Misc", "ExpandModelDisplay");
Misc.ExpandPAxisDisplay = cfg.get_boolean ("Misc", "ExpandPAxisDisplay");
} catch (const Glib::KeyFileError &err) {
Misc.ExpandLayerDisplay = false;
Misc.ExpandModelDisplay = false;
Misc.ExpandPAxisDisplay = false;
}

try {
Expand Down Expand Up @@ -759,6 +761,7 @@ void Settings::save_settings(Glib::RefPtr<Gio::File> file)

cfg.set_boolean("Misc", "ExpandLayerDisplay", Misc.ExpandLayerDisplay);
cfg.set_boolean("Misc", "ExpandModelDisplay", Misc.ExpandModelDisplay);
cfg.set_boolean("Misc", "ExpandPAxisDisplay", Misc.ExpandPAxisDisplay);

GCode.m_impl->saveSettings (cfg);

Expand Down Expand Up @@ -857,6 +860,9 @@ void Settings::set_to_gui (Builder &builder, int i)
builder->get_widget ("model_expander", exp);
if (exp)
exp->set_expanded(Misc.ExpandModelDisplay);
builder->get_widget ("printeraxis_expander", exp);
if (exp)
exp->set_expanded(Misc.ExpandPAxisDisplay);
}


Expand Down
1 change: 1 addition & 0 deletions src/settings.h
Expand Up @@ -206,6 +206,7 @@ class Settings {
int window_posy;
bool ExpandLayerDisplay;
bool ExpandModelDisplay;
bool ExpandPAxisDisplay;
};
MiscSettings Misc;

Expand Down
5 changes: 4 additions & 1 deletion src/view.cpp
Expand Up @@ -951,6 +951,9 @@ void View::save_settings_to(Glib::RefPtr < Gio::File > file)
m_builder->get_widget ("model_expander", exp);
if (exp)
m_model->settings.Misc.ExpandModelDisplay = exp->get_expanded();
m_builder->get_widget ("printeraxis_expander", exp);
if (exp)
m_model->settings.Misc.ExpandPAxisDisplay = exp->get_expanded();
m_model->SaveConfig(file);
}

Expand Down Expand Up @@ -1696,7 +1699,7 @@ void View::setModel(Model *model)
// FIXME: better have settings here and delegate to model AND printer
m_model->settings.connect_to_ui (*((Builder *)&m_builder));

m_printer->setModel(model);
m_printer->setModel(m_model);

showAllWidgets();
}
Expand Down

0 comments on commit 936f1ba

Please sign in to comment.