Finish moving text markup flags to project-level settings.

This commit is contained in:
Jeff Young 2020-04-13 00:28:33 +01:00
parent 122b1ddaae
commit d014dc47ab
7 changed files with 39 additions and 114 deletions

View File

@ -52,11 +52,6 @@ bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataToWindow()
EESCHEMA_SETTINGS* cfg = m_frame->eeconfig(); EESCHEMA_SETTINGS* cfg = m_frame->eeconfig();
m_checkShowHiddenPins->SetValue( cfg->m_Appearance.show_hidden_pins ); m_checkShowHiddenPins->SetValue( cfg->m_Appearance.show_hidden_pins );
int superSubFlags = ENABLE_SUBSCRIPT_MARKUP | ENABLE_SUPERSCRIPT_MARKUP;
m_checkSuperSub->SetValue( GetTextMarkupFlags() & superSubFlags );
m_checkPageLimits->SetValue( cfg->m_Appearance.show_page_limits ); m_checkPageLimits->SetValue( cfg->m_Appearance.show_page_limits );
m_checkSelTextBox->SetValue( cfg->m_Selection.text_as_box ); m_checkSelTextBox->SetValue( cfg->m_Selection.text_as_box );
@ -76,18 +71,12 @@ bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow()
cfg->m_Appearance.show_hidden_pins = m_checkShowHiddenPins->GetValue(); cfg->m_Appearance.show_hidden_pins = m_checkShowHiddenPins->GetValue();
cfg->m_Appearance.show_page_limits = m_checkPageLimits->GetValue(); cfg->m_Appearance.show_page_limits = m_checkPageLimits->GetValue();
cfg->m_Selection.text_as_box = m_checkSelTextBox->GetValue(); cfg->m_Selection.text_as_box = m_checkSelTextBox->GetValue();
cfg->m_Selection.draw_selected_children = m_checkSelDrawChildItems->GetValue(); cfg->m_Selection.draw_selected_children = m_checkSelDrawChildItems->GetValue();
cfg->m_Selection.fill_shapes = m_checkSelFillShapes->GetValue(); cfg->m_Selection.fill_shapes = m_checkSelFillShapes->GetValue();
cfg->m_Selection.thickness = KiROUND( m_selWidthCtrl->GetValue() ); cfg->m_Selection.thickness = KiROUND( m_selWidthCtrl->GetValue() );
int superSubFlags = ENABLE_SUBSCRIPT_MARKUP | ENABLE_SUPERSCRIPT_MARKUP;
if( m_checkSuperSub->GetValue() )
SetTextMarkupFlags( GetTextMarkupFlags() | superSubFlags );
else
SetTextMarkupFlags( GetTextMarkupFlags() & ~superSubFlags );
// Update canvas // Update canvas
m_frame->GetRenderSettings()->m_ShowHiddenPins = m_checkShowHiddenPins->GetValue(); m_frame->GetRenderSettings()->m_ShowHiddenPins = m_checkShowHiddenPins->GetValue();
m_frame->GetRenderSettings()->SetShowPageLimits( cfg->m_Appearance.show_page_limits ); m_frame->GetRenderSettings()->SetShowPageLimits( cfg->m_Appearance.show_page_limits );

View File

@ -26,10 +26,7 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE::PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWind
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Appearance") ), wxVERTICAL ); sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Appearance") ), wxVERTICAL );
m_checkShowHiddenPins = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("S&how hidden pins"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkShowHiddenPins = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("S&how hidden pins"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer1->Add( m_checkShowHiddenPins, 0, wxEXPAND|wxALL, 5 ); sbSizer1->Add( m_checkShowHiddenPins, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_checkSuperSub = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Enable superscript/subscript markup"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer1->Add( m_checkSuperSub, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_checkPageLimits = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Show page limi&ts"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkPageLimits = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Show page limi&ts"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkPageLimits->SetValue(true); m_checkPageLimits->SetValue(true);

View File

@ -88,7 +88,7 @@
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property> <property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxCheckBox" expanded="0"> <object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
@ -150,70 +150,6 @@
<property name="window_style"></property> <property name="window_style"></property>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Enable superscript/subscript markup</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_checkSuperSub</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property> <property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>

View File

@ -34,7 +34,6 @@ class PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE : public wxPanel
protected: protected:
wxBoxSizer* m_galOptionsSizer; wxBoxSizer* m_galOptionsSizer;
wxCheckBox* m_checkShowHiddenPins; wxCheckBox* m_checkShowHiddenPins;
wxCheckBox* m_checkSuperSub;
wxCheckBox* m_checkPageLimits; wxCheckBox* m_checkPageLimits;
wxCheckBox* m_checkSelTextBox; wxCheckBox* m_checkSelTextBox;
wxCheckBox* m_checkSelDrawChildItems; wxCheckBox* m_checkSelDrawChildItems;

View File

@ -55,6 +55,7 @@
static double s_textOffsetRatio = 0.08; static double s_textOffsetRatio = 0.08;
static int s_textMarkupFlags = 0;
#define FieldNameTemplatesKey wxT( "FieldNameTemplates" ) #define FieldNameTemplatesKey wxT( "FieldNameTemplates" )
@ -280,6 +281,8 @@ void SCH_EDIT_FRAME::AddFormattingParameters( std::vector<PARAM_CFG*>& params )
&s_textOffsetRatio, &s_textOffsetRatio,
(double) TXT_MARGIN / DEFAULT_SIZE_TEXT, (double) TXT_MARGIN / DEFAULT_SIZE_TEXT,
-200.0, 200.0 ) ); -200.0, 200.0 ) );
params.push_back( new PARAM_CFG_INT( wxT( "TextMarkupFlags" ),
&s_textMarkupFlags, 0 ) );
params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "LineThickness" ), params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "LineThickness" ),
&m_defaultLineWidth, &m_defaultLineWidth,
Mils2iu( appSettings->m_Drawing.default_line_thickness ), Mils2iu( appSettings->m_Drawing.default_line_thickness ),
@ -339,6 +342,8 @@ bool SCH_EDIT_FRAME::LoadProjectFile()
bool ret = Prj().ConfigLoad( Kiface().KifaceSearch(), GROUP_SCH_EDIT, bool ret = Prj().ConfigLoad( Kiface().KifaceSearch(), GROUP_SCH_EDIT,
GetProjectFileParameters() ); GetProjectFileParameters() );
SetTextMarkupFlags( s_textMarkupFlags );
GetRenderSettings()->m_DefaultLineWidth = GetDefaultLineWidth(); GetRenderSettings()->m_DefaultLineWidth = GetDefaultLineWidth();
GetRenderSettings()->m_DefaultWireThickness = GetDefaultWireThickness(); GetRenderSettings()->m_DefaultWireThickness = GetDefaultWireThickness();
GetRenderSettings()->m_DefaultBusThickness = GetDefaultBusThickness(); GetRenderSettings()->m_DefaultBusThickness = GetDefaultBusThickness();
@ -391,6 +396,8 @@ void SCH_EDIT_FRAME::SaveProjectSettings()
wxString path = fn.GetFullPath(); wxString path = fn.GetFullPath();
s_textMarkupFlags = GetTextMarkupFlags();
prj.ConfigSave( Kiface().KifaceSearch(), GROUP_SCH_EDIT, GetProjectFileParameters(), path ); prj.ConfigSave( Kiface().KifaceSearch(), GROUP_SCH_EDIT, GetProjectFileParameters(), path );
} }
@ -420,8 +427,6 @@ void SCH_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
{ {
eeconfig()->m_Appearance.print_sheet_reference = m_printSheetReference; eeconfig()->m_Appearance.print_sheet_reference = m_printSheetReference;
eeconfig()->m_Drawing.text_markup_flags = GetTextMarkupFlags();
eeconfig()->m_Printing.monochrome = m_printMonochrome; eeconfig()->m_Printing.monochrome = m_printMonochrome;
eeconfig()->m_System.units = static_cast<int>( m_userUnits ); eeconfig()->m_System.units = static_cast<int>( m_userUnits );

View File

@ -65,8 +65,7 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() : APP_SETTINGS_BASE( "eeschema", eeschema
m_params.emplace_back( new PARAM<bool>( "appearance.show_page_limits", m_params.emplace_back( new PARAM<bool>( "appearance.show_page_limits",
&m_Appearance.show_page_limits, true ) ); &m_Appearance.show_page_limits, true ) );
m_params.emplace_back( m_params.emplace_back( new PARAM<bool>( "appearance.show_sheet_filename_case_sensitivity_dialog",
new PARAM<bool>( "appearance.show_sheet_filename_case_sensitivity_dialog",
&m_Appearance.show_sheet_filename_case_sensitivity_dialog, true ) ); &m_Appearance.show_sheet_filename_case_sensitivity_dialog, true ) );
m_params.emplace_back( new PARAM<bool>( "autoplace_fields.enable", m_params.emplace_back( new PARAM<bool>( "autoplace_fields.enable",
@ -96,11 +95,11 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() : APP_SETTINGS_BASE( "eeschema", eeschema
m_params.emplace_back( new PARAM<int>( "drawing.default_wire_thickness", m_params.emplace_back( new PARAM<int>( "drawing.default_wire_thickness",
&m_Drawing.default_wire_thickness, DEFAULT_WIRE_THICKNESS ) ); &m_Drawing.default_wire_thickness, DEFAULT_WIRE_THICKNESS ) );
m_params.emplace_back( m_params.emplace_back( new PARAM<wxString>( "drawing.field_names",
new PARAM<wxString>( "drawing.field_names", &m_Drawing.field_names, "" ) ); &m_Drawing.field_names, "" ) );
m_params.emplace_back( m_params.emplace_back( new PARAM<bool>( "drawing.hv_lines_only",
new PARAM<bool>( "drawing.hv_lines_only", &m_Drawing.hv_lines_only, true ) ); &m_Drawing.hv_lines_only, true ) );
m_params.emplace_back( new PARAM<int>( "drawing.repeat_label_increment", m_params.emplace_back( new PARAM<int>( "drawing.repeat_label_increment",
&m_Drawing.repeat_label_increment, 1, -10, 10 ) ); &m_Drawing.repeat_label_increment, 1, -10, 10 ) );
@ -111,13 +110,11 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() : APP_SETTINGS_BASE( "eeschema", eeschema
m_params.emplace_back( new PARAM<COLOR4D>( "drawing.default_sheet_background_color", m_params.emplace_back( new PARAM<COLOR4D>( "drawing.default_sheet_background_color",
&m_Drawing.default_sheet_background_color, COLOR4D( WHITE ).WithAlpha( 0.0 ) ) ); &m_Drawing.default_sheet_background_color, COLOR4D( WHITE ).WithAlpha( 0.0 ) ) );
m_params.emplace_back( m_params.emplace_back( new PARAM<bool>( "input.drag_is_move",
new PARAM<int>( "drawing.text_markup_flags", &m_Drawing.text_markup_flags, 0 ) ); &m_Input.drag_is_move, true ) );
m_params.emplace_back( new PARAM<bool>( "input.drag_is_move", &m_Input.drag_is_move, true ) ); m_params.emplace_back( new PARAM<int>( "selection.thickness",
&m_Selection.thickness, 3 ) );
m_params.emplace_back(
new PARAM<int>( "selection.thickness", &m_Selection.thickness, 3 ) );
m_params.emplace_back( new PARAM<bool>( "selection.draw_selected_children", m_params.emplace_back( new PARAM<bool>( "selection.draw_selected_children",
&m_Selection.draw_selected_children, true ) ); &m_Selection.draw_selected_children, true ) );
@ -131,8 +128,8 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() : APP_SETTINGS_BASE( "eeschema", eeschema
m_params.emplace_back( new PARAM<bool>( "selection.text_as_box", m_params.emplace_back( new PARAM<bool>( "selection.text_as_box",
&m_Selection.text_as_box, false ) ); &m_Selection.text_as_box, false ) );
m_params.emplace_back( m_params.emplace_back( new PARAM<int>( "annotation.method",
new PARAM<int>( "annotation.method", &m_AnnotatePanel.method, 0, 0, 2 ) ); &m_AnnotatePanel.method, 0, 0, 2 ) );
m_params.emplace_back( new PARAM<int>( "annotation.messages_filter", m_params.emplace_back( new PARAM<int>( "annotation.messages_filter",
&m_AnnotatePanel.messages_filter, -1 ) ); &m_AnnotatePanel.messages_filter, -1 ) );
@ -140,10 +137,11 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() : APP_SETTINGS_BASE( "eeschema", eeschema
m_params.emplace_back( new PARAM<int>( "annotation.sort_order", m_params.emplace_back( new PARAM<int>( "annotation.sort_order",
&m_AnnotatePanel.sort_order, 0, 0, 1 ) ); &m_AnnotatePanel.sort_order, 0, 0, 1 ) );
m_params.emplace_back( m_params.emplace_back( new PARAM<wxString>( "bom.selected_plugin",
new PARAM<wxString>( "bom.selected_plugin", &m_BomPanel.selected_plugin, "" ) ); &m_BomPanel.selected_plugin, "" ) );
m_params.emplace_back( new PARAM<wxString>( "bom.plugins", &m_BomPanel.plugins, "" ) ); m_params.emplace_back( new PARAM<wxString>( "bom.plugins",
&m_BomPanel.plugins, "" ) );
m_params.emplace_back( new PARAM<bool>( "page_settings.export_revision", m_params.emplace_back( new PARAM<bool>( "page_settings.export_revision",
&m_PageSettings.export_revision, false ) ); &m_PageSettings.export_revision, false ) );
@ -190,15 +188,17 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() : APP_SETTINGS_BASE( "eeschema", eeschema
m_params.emplace_back( new PARAM_MAP<bool>( "field_editor.fields_group_by", m_params.emplace_back( new PARAM_MAP<bool>( "field_editor.fields_group_by",
&m_FieldEditorPanel.fields_group_by, {} ) ); &m_FieldEditorPanel.fields_group_by, {} ) );
m_params.emplace_back( m_params.emplace_back( new PARAM<bool>( "plot.background_color",
new PARAM<bool>( "plot.background_color", &m_PlotPanel.background_color, false ) ); &m_PlotPanel.background_color, false ) );
m_params.emplace_back( new PARAM<bool>( "plot.color", &m_PlotPanel.color, true ) ); m_params.emplace_back( new PARAM<bool>( "plot.color",
&m_PlotPanel.color, true ) );
m_params.emplace_back( m_params.emplace_back( new PARAM<wxString>( "plot.color_theme",
new PARAM<wxString>( "plot.color_theme", &m_PlotPanel.color_theme, wxT( "user" ) ) ); &m_PlotPanel.color_theme, wxT( "user" ) ) );
m_params.emplace_back( new PARAM<int>( "plot.format", &m_PlotPanel.format, 0 ) ); m_params.emplace_back( new PARAM<int>( "plot.format",
&m_PlotPanel.format, 0 ) );
m_params.emplace_back( new PARAM<bool>( "plot.frame_reference", m_params.emplace_back( new PARAM<bool>( "plot.frame_reference",
&m_PlotPanel.frame_reference, true ) ); &m_PlotPanel.frame_reference, true ) );
@ -209,14 +209,14 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() : APP_SETTINGS_BASE( "eeschema", eeschema
m_params.emplace_back( new PARAM<double>( "plot.hpgl_pen_size", m_params.emplace_back( new PARAM<double>( "plot.hpgl_pen_size",
&m_PlotPanel.hpgl_pen_size, 0.5 ) ); &m_PlotPanel.hpgl_pen_size, 0.5 ) );
m_params.emplace_back( m_params.emplace_back( new PARAM<bool>( "plot.hpgl_origin",
new PARAM<bool>( "plot.hpgl_origin", &m_PlotPanel.hpgl_origin, false ) ); &m_PlotPanel.hpgl_origin, false ) );
m_params.emplace_back( m_params.emplace_back( new PARAM<int>( "simulator.window.pos_x",
new PARAM<int>( "simulator.window.pos_x", &m_Simulator.window.pos_x, 0 ) ); &m_Simulator.window.pos_x, 0 ) );
m_params.emplace_back( m_params.emplace_back( new PARAM<int>( "simulator.window.pos_y",
new PARAM<int>( "simulator.window.pos_y", &m_Simulator.window.pos_y, 0 ) ); &m_Simulator.window.pos_y, 0 ) );
m_params.emplace_back( new PARAM<int>( "simulator.window.size_x", m_params.emplace_back( new PARAM<int>( "simulator.window.size_x",
&m_Simulator.window.size_x, 500 ) ); &m_Simulator.window.size_x, 500 ) );

View File

@ -68,7 +68,6 @@ public:
wxString field_names; wxString field_names;
bool hv_lines_only; bool hv_lines_only;
int repeat_label_increment; int repeat_label_increment;
int text_markup_flags;
}; };
struct INPUT struct INPUT