mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-07-13 17:11:48 +08:00
Fix layout from OG_custom
This commit is contained in:
parent
bd36042523
commit
4da0a6efe1
@ -2,12 +2,6 @@
|
|||||||
<!-- Generator: Adobe Illustrator 23.0.6, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
<!-- Generator: Adobe Illustrator 23.0.6, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
<svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
<svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||||
viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">
|
viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">
|
||||||
<path id="undo_1_" fill="#2172eb" d="M1.95,7.01h10.24L8.86,2.51c-0.31-0.42-0.22-1.01,0.2-1.32c0.42-0.31,1.01-0.22,1.32,0.2
|
<path id="background_white_1_" fill="#ffffff" d="M 1.337373,6.1250997 10.523316,6.0815623 7.9003335,2.4654392 C 7.2747405,1.5361462 7.7643506,0.69105937 8.4771954,0.27549438 9.1410379,-0.11150384 10.22409,0.04292985 10.822715,0.78475227 l 4.522254,6.09993063 c 0,0.019477 0.01088,0.019477 0.01088,0.038952 0.01089,0.019477 0.02176,0.05843 0.03266,0.077906 0.01089,0.038952 0.03266,0.097382 0.04354,0.1363348 0.01089,0.038952 0.02176,0.05843 0.03266,0.097382 0.01088,0.019477 0.01088,0.05843 0.02176,0.077906 0.01089,0.038952 0.02176,0.097382 0.02176,0.1363349 0.01089,0.038952 0.01089,0.077906 0.02176,0.1168593 0,0.019477 0,0.05843 0.01088,0.077906 0,0.038952 0.01089,0.097382 0.01089,0.136335 0,0.038952 0.01088,0.097382 0.01088,0.136335 v 0.038952 0.038952 c 0,0.038952 0,0.097382 -0.01088,0.1363349 0,0.038953 0,0.097382 -0.01089,0.1363351 0,0.019477 0,0.05843 -0.01088,0.077906 0,0.038952 -0.01089,0.077906 -0.02176,0.1168593 -0.01088,0.038952 -0.01088,0.097382 -0.02176,0.1363349 -0.01089,0.019477 -0.01089,0.05843 -0.02176,0.077906 -0.01089,0.038952 -0.02176,0.077906 -0.03266,0.097382 -0.01089,0.038952 -0.02176,0.077905 -0.04354,0.1363346 -0.01088,0.019482 -0.02176,0.058434 -0.03266,0.077905 0,0.019482 -0.01088,0.019482 -0.01088,0.038952 l -4.680073,6.3030093 c -0.473459,0.546777 -1.6420466,0.6907 -2.4054079,0.163238 C 7.4961268,14.965873 7.5883336,13.730833 7.8785692,13.341506 L 10.414473,9.7236666 1.337373,9.767204 C 0.76052572,9.8256383 0.30340136,8.9881443 0.30340136,7.9753665 c 0,-1.0127776 0.45712436,-1.8502668 1.03397164,-1.8502668 z" />
|
||||||
l4.44,6.01c0,0.01,0.01,0.01,0.01,0.02c0.01,0.01,0.02,0.03,0.03,0.04c0.01,0.02,0.03,0.05,0.04,0.07c0.01,0.02,0.02,0.03,0.03,0.05
|
<path id="arraow_red_1_" fill="#ff0000" d="M1.95,7.01h10.24L8.86,2.51c-0.31-0.42-0.22-1.01,0.2-1.32c0.42-0.31,1.01-0.22,1.32,0.2 l4.44,6.01c0,0.01,0.01,0.01,0.01,0.02c0.01,0.01,0.02,0.03,0.03,0.04c0.01,0.02,0.03,0.05,0.04,0.07c0.01,0.02,0.02,0.03,0.03,0.05 c0.01,0.01,0.01,0.03,0.02,0.04c0.01,0.02,0.02,0.05,0.02,0.07c0.01,0.02,0.01,0.04,0.02,0.06c0,0.01,0,0.03,0.01,0.04 c0,0.02,0.01,0.05,0.01,0.07c0,0.02,0.01,0.05,0.01,0.07c0,0.01,0,0.01,0,0.02c0,0.01,0,0.01,0,0.02c0,0.02,0,0.05-0.01,0.07 c0,0.02,0,0.05-0.01,0.07c0,0.01,0,0.03-0.01,0.04c0,0.02-0.01,0.04-0.02,0.06c-0.01,0.02-0.01,0.05-0.02,0.07 c-0.01,0.01-0.01,0.03-0.02,0.04c-0.01,0.02-0.02,0.04-0.03,0.05c-0.01,0.02-0.02,0.04-0.04,0.07c-0.01,0.01-0.02,0.03-0.03,0.04 c0,0.01-0.01,0.01-0.01,0.02l-4.54,6.05c-0.19,0.25-0.47,0.38-0.76,0.38c-0.2,0-0.4-0.06-0.57-0.19c-0.42-0.31-0.5-0.91-0.19-1.32 l3.41-4.54H1.95C1.42,8.91,1,8.48,1,7.96C1,7.44,1.42,7.01,1.95,7.01z" />
|
||||||
c0.01,0.01,0.01,0.03,0.02,0.04c0.01,0.02,0.02,0.05,0.02,0.07c0.01,0.02,0.01,0.04,0.02,0.06c0,0.01,0,0.03,0.01,0.04
|
|
||||||
c0,0.02,0.01,0.05,0.01,0.07c0,0.02,0.01,0.05,0.01,0.07c0,0.01,0,0.01,0,0.02c0,0.01,0,0.01,0,0.02c0,0.02,0,0.05-0.01,0.07
|
|
||||||
c0,0.02,0,0.05-0.01,0.07c0,0.01,0,0.03-0.01,0.04c0,0.02-0.01,0.04-0.02,0.06c-0.01,0.02-0.01,0.05-0.02,0.07
|
|
||||||
c-0.01,0.01-0.01,0.03-0.02,0.04c-0.01,0.02-0.02,0.04-0.03,0.05c-0.01,0.02-0.02,0.04-0.04,0.07c-0.01,0.01-0.02,0.03-0.03,0.04
|
|
||||||
c0,0.01-0.01,0.01-0.01,0.02l-4.54,6.05c-0.19,0.25-0.47,0.38-0.76,0.38c-0.2,0-0.4-0.06-0.57-0.19c-0.42-0.31-0.5-0.91-0.19-1.32
|
|
||||||
l3.41-4.54H1.95C1.42,8.91,1,8.48,1,7.96C1,7.44,1.42,7.01,1.95,7.01z"/>
|
|
||||||
</svg>
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 2.8 KiB |
@ -44,7 +44,7 @@ each parameter is separated by ':'
|
|||||||
* full_label: to override the label by the "full one".
|
* full_label: to override the label by the "full one".
|
||||||
* full_width: to tell to create a field that span the full width.
|
* full_width: to tell to create a field that span the full width.
|
||||||
* sidetext$STR: the suffix at the right of the widget (like 'mm').
|
* sidetext$STR: the suffix at the right of the widget (like 'mm').
|
||||||
* sidetext_width$INT: the suffix label length (override the group one). 0 for auto.
|
* sidetext_width$INT: the suffix label length (override the group one). -& for auto.
|
||||||
* simple|advanced|expert: add one of these to modify the mode in which this setting appear.
|
* simple|advanced|expert: add one of these to modify the mode in which this setting appear.
|
||||||
* width$INT: change the width of the field. Shouod work on most type of settings.
|
* width$INT: change the width of the field. Shouod work on most type of settings.
|
||||||
* height$INT: change the height of the field. Don't works with every type of setting.
|
* height$INT: change the height of the field. Don't works with every type of setting.
|
||||||
|
@ -39,10 +39,10 @@ group:Quality
|
|||||||
setting:width$5:thin_walls_overlap
|
setting:width$5:thin_walls_overlap
|
||||||
setting:thin_walls_merge
|
setting:thin_walls_merge
|
||||||
end_line
|
end_line
|
||||||
group:Overhangs
|
group:label_width$12:Overhangs
|
||||||
line:threshold for
|
line:threshold for
|
||||||
setting:label$bridge speed and fan:width$5:overhangs_width_speed
|
setting:label$Bridge speed and fan:width$5:overhangs_width_speed
|
||||||
setting:label$bridge flow:width$5:overhangs_width
|
setting:label$Bridge flow:width$5:overhangs_width
|
||||||
end_line
|
end_line
|
||||||
line:Extrusion direction
|
line:Extrusion direction
|
||||||
setting:sidetext_width$1:overhangs_reverse
|
setting:sidetext_width$1:overhangs_reverse
|
||||||
@ -80,12 +80,12 @@ group:Filtering
|
|||||||
setting:resolution
|
setting:resolution
|
||||||
setting:model_precision
|
setting:model_precision
|
||||||
setting:slice_closing_radius
|
setting:slice_closing_radius
|
||||||
group:label_width$8:Modifying slices
|
group:Modifying slices
|
||||||
line:Curve smoothing
|
line:Curve smoothing
|
||||||
setting:width$6:curve_smoothing_precision
|
setting:width$6:curve_smoothing_precision
|
||||||
setting:width$6:curve_smoothing_angle_convex
|
setting:width$6:curve_smoothing_angle_convex
|
||||||
setting:width$6:curve_smoothing_angle_concave
|
setting:width$6:curve_smoothing_angle_concave
|
||||||
setting:width$6:curve_smoothing_cutoff_dist
|
setting:label_width$6:width$6:curve_smoothing_cutoff_dist
|
||||||
end_line
|
end_line
|
||||||
setting:hole_to_polyhole
|
setting:hole_to_polyhole
|
||||||
line:XY compensation
|
line:XY compensation
|
||||||
@ -118,36 +118,36 @@ group:Reducing printing time
|
|||||||
setting:infill_every_layers
|
setting:infill_every_layers
|
||||||
setting:infill_only_where_needed
|
setting:infill_only_where_needed
|
||||||
line:Supporting dense layer
|
line:Supporting dense layer
|
||||||
setting:infill_dense
|
setting:sidetext_width$0:infill_dense
|
||||||
setting:infill_dense_algo
|
setting:infill_dense_algo
|
||||||
end_line
|
end_line
|
||||||
group:sidetext_width$3:Advanced
|
group:sidetext_width$3:Advanced
|
||||||
setting:solid_infill_every_layers
|
setting:solid_infill_every_layers
|
||||||
setting:solid_infill_below_area
|
setting:solid_infill_below_area
|
||||||
line:Angle
|
line:Angle
|
||||||
setting:label_width$6:width$5:fill_angle
|
setting:label_width$8:width$5:fill_angle
|
||||||
setting:label_width$6:width$5:bridge_angle
|
setting:label_width$6:width$5:bridge_angle
|
||||||
setting:label_width$6:width$5:label$increment:fill_angle_increment
|
setting:label_width$6:width$5:label$increment:fill_angle_increment
|
||||||
end_line
|
end_line
|
||||||
line:Anchor solid infill by X mm
|
line:Anchor solid infill by X mm
|
||||||
setting:label_width$6:width$5:external_infill_margin
|
setting:label_width$8:width$5:external_infill_margin
|
||||||
setting:label_width$6:width$5:bridged_infill_margin
|
setting:label_width$6:width$5:bridged_infill_margin
|
||||||
end_line
|
end_line
|
||||||
setting:only_retract_when_crossing_perimeters
|
setting:only_retract_when_crossing_perimeters
|
||||||
setting:infill_first
|
setting:infill_first
|
||||||
group:Advanced Infill options
|
group:Advanced Infill options
|
||||||
line:Ironing infill tuning
|
line:Ironing infill tuning
|
||||||
setting:label_width$9:width$5:fill_smooth_distribution
|
setting:label_width$8:width$5:fill_smooth_distribution
|
||||||
setting:label$Spacing between ironing lines:width$5:sidetext_width$7:fill_smooth_width
|
setting:label_width$26:label$Spacing between ironing lines:width$5:sidetext_width$7:fill_smooth_width
|
||||||
end_line
|
end_line
|
||||||
group:Ironing post-process (This will go on top of infills and perimeters)
|
group:Ironing post-process (This will go on top of infills and perimeters)
|
||||||
line:Enable ironing post-process
|
line:Enable ironing post-process
|
||||||
setting:label$_:ironing
|
setting:label$_:sidetext_width$0:ironing
|
||||||
setting:label$On:ironing_type
|
setting:label$On:ironing_type
|
||||||
end_line
|
end_line
|
||||||
line:Tuning ironing
|
line:Tuning ironing
|
||||||
setting:ironing_flowrate
|
setting:label_width$8:width$5:ironing_flowrate
|
||||||
setting:ironing_spacing
|
setting:label_width$26:width$5:ironing_spacing
|
||||||
end_line
|
end_line
|
||||||
|
|
||||||
page:Skirt & Brim:skirt+brim
|
page:Skirt & Brim:skirt+brim
|
||||||
|
@ -764,7 +764,7 @@ void PrintConfigDef::init_fff_params()
|
|||||||
def->full_label = L("Default infill margin");
|
def->full_label = L("Default infill margin");
|
||||||
def->category = OptionCategory::infill;
|
def->category = OptionCategory::infill;
|
||||||
def->tooltip = L("This parameter grows the top/bottom/solid layers by the specified MM to anchor them into the part. Put 0 to deactivate it. Can be a % of the width of the perimeters.");
|
def->tooltip = L("This parameter grows the top/bottom/solid layers by the specified MM to anchor them into the part. Put 0 to deactivate it. Can be a % of the width of the perimeters.");
|
||||||
def->sidetext = L("mm");
|
def->sidetext = L("mm/%");
|
||||||
def->ratio_over = "perimeter_extrusion_width";
|
def->ratio_over = "perimeter_extrusion_width";
|
||||||
def->min = 0;
|
def->min = 0;
|
||||||
def->mode = comExpert;
|
def->mode = comExpert;
|
||||||
@ -775,7 +775,7 @@ void PrintConfigDef::init_fff_params()
|
|||||||
def->full_label = L("Bridge margin");
|
def->full_label = L("Bridge margin");
|
||||||
def->category = OptionCategory::infill;
|
def->category = OptionCategory::infill;
|
||||||
def->tooltip = L("This parameter grows the bridged solid infill layers by the specified MM to anchor them into the part. Put 0 to deactivate it. Can be a % of the width of the external perimeter.");
|
def->tooltip = L("This parameter grows the bridged solid infill layers by the specified MM to anchor them into the part. Put 0 to deactivate it. Can be a % of the width of the external perimeter.");
|
||||||
def->sidetext = L("mm");
|
def->sidetext = L("mm/%");
|
||||||
def->ratio_over = "external_perimeter_extrusion_width";
|
def->ratio_over = "external_perimeter_extrusion_width";
|
||||||
def->min = 0;
|
def->min = 0;
|
||||||
def->mode = comExpert;
|
def->mode = comExpert;
|
||||||
@ -897,15 +897,15 @@ void PrintConfigDef::init_fff_params()
|
|||||||
def->set_default_value(new ConfigOptionBool(false));
|
def->set_default_value(new ConfigOptionBool(false));
|
||||||
|
|
||||||
def = this->add("external_perimeters_nothole", coBool);
|
def = this->add("external_perimeters_nothole", coBool);
|
||||||
def->label = L("only for outter side");
|
def->label = L("Only for outer side");
|
||||||
def->full_label = L("ext peri first for outter side");
|
def->full_label = L("ext peri first for outer side");
|
||||||
def->category = OptionCategory::perimeter;
|
def->category = OptionCategory::perimeter;
|
||||||
def->tooltip = L("Only do the vase trick on the external side. Useful when the thikness is too low.");
|
def->tooltip = L("Only do the vase trick on the external side. Useful when the thikness is too low.");
|
||||||
def->mode = comExpert;
|
def->mode = comExpert;
|
||||||
def->set_default_value(new ConfigOptionBool(true));
|
def->set_default_value(new ConfigOptionBool(true));
|
||||||
|
|
||||||
def = this->add("external_perimeters_hole", coBool);
|
def = this->add("external_perimeters_hole", coBool);
|
||||||
def->label = L("only for inner side");
|
def->label = L("Only for inner side");
|
||||||
def->full_label = L("ext peri first for inner side");
|
def->full_label = L("ext peri first for inner side");
|
||||||
def->category = OptionCategory::perimeter;
|
def->category = OptionCategory::perimeter;
|
||||||
def->tooltip = L("Only do the vase trick on the external side. Useful when you only want to remode seam from screw hole.");
|
def->tooltip = L("Only do the vase trick on the external side. Useful when you only want to remode seam from screw hole.");
|
||||||
@ -1389,6 +1389,7 @@ void PrintConfigDef::init_fff_params()
|
|||||||
|
|
||||||
def = this->add("filament_density", coFloats);
|
def = this->add("filament_density", coFloats);
|
||||||
def->label = L("Density");
|
def->label = L("Density");
|
||||||
|
def->category = OptionCategory::filament;
|
||||||
def->tooltip = L("Enter your filament density here. This is only for statistical information. "
|
def->tooltip = L("Enter your filament density here. This is only for statistical information. "
|
||||||
"A decent way is to weigh a known length of filament and compute the ratio "
|
"A decent way is to weigh a known length of filament and compute the ratio "
|
||||||
"of the length to volume. Better is to calculate the volume directly through displacement.");
|
"of the length to volume. Better is to calculate the volume directly through displacement.");
|
||||||
@ -1607,7 +1608,7 @@ void PrintConfigDef::init_fff_params()
|
|||||||
def->ratio_over = "top_infill_extrusion_width";
|
def->ratio_over = "top_infill_extrusion_width";
|
||||||
def->min = 0;
|
def->min = 0;
|
||||||
def->mode = comExpert;
|
def->mode = comExpert;
|
||||||
def->sidetext = L("% or mm");
|
def->sidetext = L("mm/%");
|
||||||
def->set_default_value(new ConfigOptionFloatOrPercent(50, true));
|
def->set_default_value(new ConfigOptionFloatOrPercent(50, true));
|
||||||
|
|
||||||
def = this->add("fill_smooth_distribution", coPercent);
|
def = this->add("fill_smooth_distribution", coPercent);
|
||||||
@ -3850,8 +3851,8 @@ void PrintConfigDef::init_fff_params()
|
|||||||
def->set_default_value(new ConfigOptionFloat(10.));
|
def->set_default_value(new ConfigOptionFloat(10.));
|
||||||
|
|
||||||
def = this->add("xy_size_compensation", coFloat);
|
def = this->add("xy_size_compensation", coFloat);
|
||||||
def->label = L("Outter");
|
def->label = L("outer");
|
||||||
def->full_label = L("Outter XY size compensation");
|
def->full_label = L("outer XY size compensation");
|
||||||
def->category = OptionCategory::slicing;
|
def->category = OptionCategory::slicing;
|
||||||
def->tooltip = L("The object will be grown/shrunk in the XY plane by the configured value "
|
def->tooltip = L("The object will be grown/shrunk in the XY plane by the configured value "
|
||||||
"(negative = inwards, positive = outwards). This might be useful for fine-tuning sizes."
|
"(negative = inwards, positive = outwards). This might be useful for fine-tuning sizes."
|
||||||
|
@ -220,7 +220,7 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true
|
|||||||
wxString label = m_opt.full_label.empty() ? _(m_opt.label) : _(m_opt.full_label);
|
wxString label = m_opt.full_label.empty() ? _(m_opt.label) : _(m_opt.full_label);
|
||||||
show_error(m_parent, from_u8((boost::format(_utf8(L("%s doesn't support percentage"))) % label).str()));
|
show_error(m_parent, from_u8((boost::format(_utf8(L("%s doesn't support percentage"))) % label).str()));
|
||||||
set_value(double_to_string(m_opt.min), true);
|
set_value(double_to_string(m_opt.min), true);
|
||||||
m_value = m_opt.min;
|
m_value = double(m_opt.min);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
double val;
|
double val;
|
||||||
@ -301,7 +301,8 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true
|
|||||||
if (dialog.ShowModal() == wxID_YES) {
|
if (dialog.ShowModal() == wxID_YES) {
|
||||||
set_value(from_u8((boost::format("%s%%") % stVal).str()), false/*true*/);
|
set_value(from_u8((boost::format("%s%%") % stVal).str()), false/*true*/);
|
||||||
str += "%%";
|
str += "%%";
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
set_value(stVal, false); // it's no needed but can be helpful, when inputted value contained "," instead of "."
|
set_value(stVal, false); // it's no needed but can be helpful, when inputted value contained "," instead of "."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -620,9 +621,8 @@ void CheckBox::set_value(const boost::any& value, bool change_event)
|
|||||||
m_last_meaningful_value = value;
|
m_last_meaningful_value = value;
|
||||||
dynamic_cast<wxCheckBox*>(window)->SetValue(m_is_na_val ? false : boost::any_cast<unsigned char>(value) != 0);
|
dynamic_cast<wxCheckBox*>(window)->SetValue(m_is_na_val ? false : boost::any_cast<unsigned char>(value) != 0);
|
||||||
}
|
}
|
||||||
else{
|
else
|
||||||
dynamic_cast<wxCheckBox*>(window)->SetValue(boost::any_cast<bool>(value));
|
dynamic_cast<wxCheckBox*>(window)->SetValue(boost::any_cast<bool>(value));
|
||||||
}
|
|
||||||
m_disable_change_event = false;
|
m_disable_change_event = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -692,7 +692,7 @@ void SpinCtrl::BUILD() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const double min_val = m_opt.min == INT_MIN
|
const int min_val = m_opt.min == INT_MIN
|
||||||
#ifdef __WXOSX__
|
#ifdef __WXOSX__
|
||||||
// We will forcibly set the input value for SpinControl, since the value
|
// We will forcibly set the input value for SpinControl, since the value
|
||||||
// inserted from the keyboard is not updated under OSX.
|
// inserted from the keyboard is not updated under OSX.
|
||||||
@ -701,8 +701,8 @@ void SpinCtrl::BUILD() {
|
|||||||
// less then min_val.
|
// less then min_val.
|
||||||
|| m_opt.min > 0
|
|| m_opt.min > 0
|
||||||
#endif
|
#endif
|
||||||
? 0. : m_opt.min;
|
? 0 : m_opt.min;
|
||||||
const double max_val = m_opt.max < 2147483647 ? m_opt.max : 2147483647.;
|
const int max_val = m_opt.max < 2147483647 ? m_opt.max : 2147483647;
|
||||||
|
|
||||||
auto temp = new wxSpinCtrl(m_parent, wxID_ANY, text_value, wxDefaultPosition, size,
|
auto temp = new wxSpinCtrl(m_parent, wxID_ANY, text_value, wxDefaultPosition, size,
|
||||||
0|wxTE_PROCESS_ENTER, min_val, max_val, default_value);
|
0|wxTE_PROCESS_ENTER, min_val, max_val, default_value);
|
||||||
@ -1142,6 +1142,7 @@ void Choice::set_values(const wxArrayString &values)
|
|||||||
|
|
||||||
m_disable_change_event = false;
|
m_disable_change_event = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::any& Choice::get_value()
|
boost::any& Choice::get_value()
|
||||||
{
|
{
|
||||||
choice_ctrl* field = dynamic_cast<choice_ctrl*>(window);
|
choice_ctrl* field = dynamic_cast<choice_ctrl*>(window);
|
||||||
|
@ -82,7 +82,7 @@ void OG_CustomCtrl::init_ctrl_lines()
|
|||||||
wxCoord height;
|
wxCoord height;
|
||||||
|
|
||||||
// if we have a single option with no label, no sidetext just add it directly to sizer
|
// if we have a single option with no label, no sidetext just add it directly to sizer
|
||||||
if (option_set.size() == 1 && opt_group->label_width == 0 && option_set.front().opt.full_width &&
|
if (option_set.size() == 1 && opt_group->title_width == 0 && option_set.front().opt.full_width &&
|
||||||
option_set.front().opt.label.empty() &&
|
option_set.front().opt.label.empty() &&
|
||||||
option_set.front().opt.sidetext.size() == 0 && option_set.front().side_widget == nullptr &&
|
option_set.front().opt.sidetext.size() == 0 && option_set.front().side_widget == nullptr &&
|
||||||
line.get_extra_widgets().size() == 0)
|
line.get_extra_widgets().size() == 0)
|
||||||
@ -90,10 +90,10 @@ void OG_CustomCtrl::init_ctrl_lines()
|
|||||||
height = m_bmp_blinking_sz.GetHeight() + m_v_gap;
|
height = m_bmp_blinking_sz.GetHeight() + m_v_gap;
|
||||||
ctrl_lines.emplace_back(CtrlLine(height, this, line, true));
|
ctrl_lines.emplace_back(CtrlLine(height, this, line, true));
|
||||||
}
|
}
|
||||||
else if (opt_group->label_width != 0 && !line.label.IsEmpty())
|
else if (opt_group->title_width != 0 && !line.label.IsEmpty())
|
||||||
{
|
{
|
||||||
wxSize label_sz = GetTextExtent(line.label);
|
wxSize label_sz = GetTextExtent(line.label);
|
||||||
height = label_sz.y * (label_sz.GetWidth() > int(opt_group->label_width * m_em_unit) ? 2 : 1) + m_v_gap;
|
height = label_sz.y * (label_sz.GetWidth() > int(opt_group->title_width * m_em_unit) ? 2 : 1) + m_v_gap;
|
||||||
ctrl_lines.emplace_back(CtrlLine(height, this, line));
|
ctrl_lines.emplace_back(CtrlLine(height, this, line));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -135,8 +135,8 @@ wxPoint OG_CustomCtrl::get_pos(const Line& line, Field* field_in/* = nullptr*/)
|
|||||||
}
|
}
|
||||||
|
|
||||||
wxString label = line.label;
|
wxString label = line.label;
|
||||||
if (opt_group->label_width != 0 && !label.IsEmpty())
|
if (opt_group->title_width != 0 && !label.IsEmpty())
|
||||||
h_pos += opt_group->label_width * m_em_unit + m_h_gap;
|
h_pos += opt_group->title_width * m_em_unit + m_h_gap;
|
||||||
|
|
||||||
int blinking_button_width = m_bmp_blinking_sz.GetWidth() + m_h_gap;
|
int blinking_button_width = m_bmp_blinking_sz.GetWidth() + m_h_gap;
|
||||||
|
|
||||||
@ -155,29 +155,50 @@ wxPoint OG_CustomCtrl::get_pos(const Line& line, Field* field_in/* = nullptr*/)
|
|||||||
option_set.front().opt.label.empty() &&
|
option_set.front().opt.label.empty() &&
|
||||||
option_set.front().side_widget == nullptr && line.get_extra_widgets().size() == 0)
|
option_set.front().side_widget == nullptr && line.get_extra_widgets().size() == 0)
|
||||||
{
|
{
|
||||||
h_pos += 3 * blinking_button_width;
|
h_pos += 2 * blinking_button_width;
|
||||||
Field* field = opt_group->get_field(option_set.front().opt_id);
|
Field* field = opt_group->get_field(option_set.front().opt_id);
|
||||||
correct_line_height(ctrl_line.height, field->getWindow());
|
correct_line_height(ctrl_line.height, field->getWindow());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto opt : option_set) {
|
for (size_t i = 0; i < option_set.size(); ++i) {
|
||||||
|
if (i >= ctrl_line.is_visible.size() || !ctrl_line.is_visible[i])
|
||||||
|
continue;
|
||||||
|
const Option& opt = option_set[i];
|
||||||
Field* field = opt_group->get_field(opt.opt_id);
|
Field* field = opt_group->get_field(opt.opt_id);
|
||||||
correct_line_height(ctrl_line.height, field->getWindow());
|
correct_line_height(ctrl_line.height, field->getWindow());
|
||||||
|
|
||||||
ConfigOptionDef option = opt.opt;
|
ConfigOptionDef option = opt.opt;
|
||||||
// add label if any
|
// add label if any
|
||||||
if (!option.label.empty()) {
|
if (!option.label.empty()) {
|
||||||
|
std::string opt_label = (option.label.empty() || option.label.back() != '_') ? option.label : option.label.substr(0, option.label.size() - 1);
|
||||||
//! To correct translation by context have to use wxGETTEXT_IN_CONTEXT macro from wxWidget 3.1.1
|
//! To correct translation by context have to use wxGETTEXT_IN_CONTEXT macro from wxWidget 3.1.1
|
||||||
label = (option.label == L_CONTEXT("Top", "Layers") || option.label == L_CONTEXT("Bottom", "Layers")) ?
|
label = (opt_label == L_CONTEXT("Top", "Layers") || opt_label == L_CONTEXT("Bottom", "Layers")) ?
|
||||||
_CTX(option.label, "Layers") : _(option.label);
|
_CTX(opt_label, "Layers") : _(opt_label);
|
||||||
|
bool no_dots = label.empty() || option.label.back() == '_';
|
||||||
|
if (!no_dots)
|
||||||
label += ":";
|
label += ":";
|
||||||
|
|
||||||
|
if (!label.empty()) {
|
||||||
wxPaintDC dc(this);
|
wxPaintDC dc(this);
|
||||||
dc.SetFont(m_font);
|
dc.SetFont(m_font);
|
||||||
h_pos += dc.GetMultiLineTextExtent(label).x + m_h_gap;
|
if (option.label_width >= 0) {
|
||||||
|
if (option.label_width != 0) {
|
||||||
|
h_pos += option.label_width * m_em_unit;
|
||||||
|
} else {
|
||||||
|
h_pos += dc.GetMultiLineTextExtent(label).x;
|
||||||
}
|
}
|
||||||
h_pos += 3 * blinking_button_width;
|
} else {
|
||||||
|
if (opt_group->label_width > 0) {
|
||||||
|
h_pos += opt_group->label_width * m_em_unit;
|
||||||
|
} else {
|
||||||
|
h_pos += dc.GetMultiLineTextExtent(label).x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
h_pos += m_h_gap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
h_pos += 2 * blinking_button_width;
|
||||||
|
|
||||||
if (field == field_in)
|
if (field == field_in)
|
||||||
break;
|
break;
|
||||||
@ -187,15 +208,15 @@ wxPoint OG_CustomCtrl::get_pos(const Line& line, Field* field_in/* = nullptr*/)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
// add sidetext if any
|
// add sidetext if any
|
||||||
if (!option.sidetext.empty() || opt_group->sidetext_width > 0)
|
if ((!option.sidetext.empty() || opt_group->sidetext_width > 0 || option.sidetext_width > 0) && option.sidetext_width != 0)
|
||||||
h_pos += opt_group->sidetext_width * m_em_unit + m_h_gap;
|
h_pos += (option.sidetext_width > 0 ? option.sidetext_width : opt_group->sidetext_width)* m_em_unit + m_h_gap;
|
||||||
|
|
||||||
if (opt.opt_id != option_set.back().opt_id) //! istead of (opt != option_set.back())
|
if (opt.opt_id != option_set.back().opt_id) //! istead of (opt != option_set.back())
|
||||||
h_pos += lround(0.6 * m_em_unit);
|
h_pos += lround(0.6 * m_em_unit);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ctrl_line.is_visible)
|
if (ctrl_line.is_line_visible)
|
||||||
v_pos += ctrl_line.height;
|
v_pos += ctrl_line.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,7 +241,7 @@ void OG_CustomCtrl::OnPaint(wxPaintEvent&)
|
|||||||
|
|
||||||
wxCoord v_pos = 0;
|
wxCoord v_pos = 0;
|
||||||
for (CtrlLine& line : ctrl_lines) {
|
for (CtrlLine& line : ctrl_lines) {
|
||||||
if (!line.is_visible)
|
if (!line.is_line_visible)
|
||||||
continue;
|
continue;
|
||||||
line.render(dc, v_pos);
|
line.render(dc, v_pos);
|
||||||
v_pos += line.height;
|
v_pos += line.height;
|
||||||
@ -315,7 +336,7 @@ bool OG_CustomCtrl::update_visibility(ConfigOptionMode mode)
|
|||||||
size_t invisible_lines = 0;
|
size_t invisible_lines = 0;
|
||||||
for (CtrlLine& line : ctrl_lines) {
|
for (CtrlLine& line : ctrl_lines) {
|
||||||
line.update_visibility(mode);
|
line.update_visibility(mode);
|
||||||
if (line.is_visible)
|
if (line.is_line_visible)
|
||||||
v_pos += (wxCoord)line.height;
|
v_pos += (wxCoord)line.height;
|
||||||
else
|
else
|
||||||
invisible_lines++;
|
invisible_lines++;
|
||||||
@ -338,14 +359,15 @@ void OG_CustomCtrl::correct_widgets_position(wxSizer* widget, const Line& line,
|
|||||||
auto children = widget->GetChildren();
|
auto children = widget->GetChildren();
|
||||||
wxPoint line_pos = get_pos(line, field);
|
wxPoint line_pos = get_pos(line, field);
|
||||||
int line_height = get_height(line);
|
int line_height = get_height(line);
|
||||||
for (auto child : children)
|
for (auto child : children) {
|
||||||
if (child->IsWindow()) {
|
if (child->IsWindow() && child->IsShown()) {
|
||||||
wxPoint pos = line_pos;
|
wxPoint pos = line_pos;
|
||||||
wxSize sz = child->GetWindow()->GetSize();
|
wxSize sz = child->GetWindow()->GetSize();
|
||||||
pos.y += std::max(0, int(0.5 * (line_height - sz.y)));
|
pos.y += std::max(0, int(0.5 * (line_height - sz.y)));
|
||||||
child->GetWindow()->SetPosition(pos);
|
child->GetWindow()->SetPosition(pos);
|
||||||
line_pos.x += sz.x + m_h_gap;
|
line_pos.x += sz.x + m_h_gap;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void OG_CustomCtrl::msw_rescale()
|
void OG_CustomCtrl::msw_rescale()
|
||||||
@ -361,7 +383,7 @@ void OG_CustomCtrl::msw_rescale()
|
|||||||
wxCoord v_pos = 0;
|
wxCoord v_pos = 0;
|
||||||
for (CtrlLine& line : ctrl_lines) {
|
for (CtrlLine& line : ctrl_lines) {
|
||||||
line.msw_rescale();
|
line.msw_rescale();
|
||||||
if (line.is_visible) {
|
if (line.is_line_visible) {
|
||||||
v_pos += (wxCoord)line.height;
|
v_pos += (wxCoord)line.height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -393,7 +415,7 @@ OG_CustomCtrl::CtrlLine::CtrlLine( wxCoord height,
|
|||||||
|
|
||||||
void OG_CustomCtrl::CtrlLine::correct_items_positions()
|
void OG_CustomCtrl::CtrlLine::correct_items_positions()
|
||||||
{
|
{
|
||||||
if (draw_just_act_buttons || !is_visible)
|
if (draw_just_act_buttons || !is_line_visible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (og_line.near_label_widget_win)
|
if (og_line.near_label_widget_win)
|
||||||
@ -421,9 +443,9 @@ void OG_CustomCtrl::CtrlLine::msw_rescale()
|
|||||||
if (draw_just_act_buttons)
|
if (draw_just_act_buttons)
|
||||||
height = get_bitmap_size(create_scaled_bitmap("empty")).GetHeight();
|
height = get_bitmap_size(create_scaled_bitmap("empty")).GetHeight();
|
||||||
|
|
||||||
if (ctrl->opt_group->label_width != 0 && !og_line.label.IsEmpty()) {
|
if (ctrl->opt_group->title_width != 0 && !og_line.label.IsEmpty()) {
|
||||||
wxSize label_sz = ctrl->GetTextExtent(og_line.label);
|
wxSize label_sz = ctrl->GetTextExtent(og_line.label);
|
||||||
height = label_sz.y * (label_sz.GetWidth() > int(ctrl->opt_group->label_width * ctrl->m_em_unit) ? 2 : 1) + ctrl->m_v_gap;
|
height = label_sz.y * (label_sz.GetWidth() > int(ctrl->opt_group->title_width * ctrl->m_em_unit) ? 2 : 1) + ctrl->m_v_gap;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (og_line.get_options().front().opt.full_width) {
|
if (og_line.get_options().front().opt.full_width) {
|
||||||
@ -439,21 +461,26 @@ void OG_CustomCtrl::CtrlLine::update_visibility(ConfigOptionMode mode)
|
|||||||
{
|
{
|
||||||
const std::vector<Option>& option_set = og_line.get_options();
|
const std::vector<Option>& option_set = og_line.get_options();
|
||||||
|
|
||||||
const ConfigOptionMode& line_mode = option_set.front().opt.mode;
|
ConfigOptionMode line_mode = option_set.front().opt.mode;
|
||||||
is_visible = line_mode <= mode;
|
for (const Option& opt : option_set)
|
||||||
|
if (opt.opt.mode < line_mode)
|
||||||
|
line_mode = opt.opt.mode;
|
||||||
|
is_line_visible = line_mode <= mode;
|
||||||
|
|
||||||
if (draw_just_act_buttons)
|
if (draw_just_act_buttons)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (og_line.near_label_widget_win)
|
if (og_line.near_label_widget_win)
|
||||||
og_line.near_label_widget_win->Show(is_visible);
|
og_line.near_label_widget_win->Show(is_line_visible);
|
||||||
if (og_line.widget_sizer)
|
if (og_line.widget_sizer)
|
||||||
og_line.widget_sizer->ShowItems(is_visible);
|
og_line.widget_sizer->ShowItems(is_line_visible);
|
||||||
if (og_line.extra_widget_sizer)
|
if (og_line.extra_widget_sizer)
|
||||||
og_line.extra_widget_sizer->ShowItems(is_visible);
|
og_line.extra_widget_sizer->ShowItems(is_line_visible);
|
||||||
|
|
||||||
for (auto opt : option_set) {
|
is_visible.clear();
|
||||||
|
for (const Option& opt : option_set) {
|
||||||
Field* field = ctrl->opt_group->get_field(opt.opt_id);
|
Field* field = ctrl->opt_group->get_field(opt.opt_id);
|
||||||
|
is_visible.push_back(opt.opt.mode <= mode);
|
||||||
if (!field)
|
if (!field)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -461,10 +488,11 @@ void OG_CustomCtrl::CtrlLine::update_visibility(ConfigOptionMode mode)
|
|||||||
auto children = field->getSizer()->GetChildren();
|
auto children = field->getSizer()->GetChildren();
|
||||||
for (auto child : children)
|
for (auto child : children)
|
||||||
if (child->IsWindow())
|
if (child->IsWindow())
|
||||||
child->GetWindow()->Show(is_visible);
|
child->GetWindow()->Show(is_visible.back());
|
||||||
|
field->getSizer()->Show(is_visible.back());
|
||||||
}
|
}
|
||||||
else if (field->getWindow())
|
else if (field->getWindow())
|
||||||
field->getWindow()->Show(is_visible);
|
field->getWindow()->Show(is_visible.back());
|
||||||
}
|
}
|
||||||
|
|
||||||
correct_items_positions();
|
correct_items_positions();
|
||||||
@ -487,12 +515,13 @@ void OG_CustomCtrl::CtrlLine::render(wxDC& dc, wxCoord v_pos)
|
|||||||
|
|
||||||
const std::vector<Option>& option_set = og_line.get_options();
|
const std::vector<Option>& option_set = og_line.get_options();
|
||||||
|
|
||||||
wxString label = og_line.label;
|
|
||||||
bool is_url_string = false;
|
bool is_url_string = false;
|
||||||
if (ctrl->opt_group->label_width != 0 && !label.IsEmpty()) {
|
if (ctrl->opt_group->title_width != 0 && !og_line.label.IsEmpty()) {
|
||||||
const wxColour* text_clr = (option_set.size() == 1 && field ? field->label_color() : og_line.full_Label_color);
|
const wxColour* text_clr = (option_set.size() == 1 && field ? field->label_color() : og_line.full_Label_color);
|
||||||
is_url_string = !og_line.label_path.IsEmpty();
|
is_url_string = !og_line.label_path.IsEmpty();
|
||||||
h_pos = draw_text(dc, wxPoint(h_pos, v_pos), label + ":", text_clr, ctrl->opt_group->label_width * ctrl->m_em_unit, is_url_string);
|
wxString opt_label = (og_line.label.empty() || og_line.label.Last() != '_') ? og_line.label : og_line.label.substr(0, og_line.label.size() - 1);
|
||||||
|
bool no_dots = og_line.label.empty() || og_line.label.Last() == '_';
|
||||||
|
h_pos = draw_text(dc, wxPoint(h_pos, v_pos), (no_dots ? opt_label : opt_label + ':'), text_clr, ctrl->opt_group->title_width * ctrl->m_em_unit, is_url_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there's a widget, build it and set result to the correct position.
|
// If there's a widget, build it and set result to the correct position.
|
||||||
@ -515,21 +544,39 @@ void OG_CustomCtrl::CtrlLine::render(wxDC& dc, wxCoord v_pos)
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t bmp_rect_id = 0;
|
size_t bmp_rect_id = 0;
|
||||||
for (const Option& opt : option_set) {
|
for (size_t i = 0; i < option_set.size(); ++i) {
|
||||||
|
if (i >= is_visible.size() || !is_visible[i])
|
||||||
|
continue;
|
||||||
|
const Option& opt = option_set[i];
|
||||||
field = ctrl->opt_group->get_field(opt.opt_id);
|
field = ctrl->opt_group->get_field(opt.opt_id);
|
||||||
ConfigOptionDef option = opt.opt;
|
ConfigOptionDef option = opt.opt;
|
||||||
// add label if any
|
// add label if any
|
||||||
if (!option.label.empty()) {
|
if (!option.label.empty()) {
|
||||||
|
std::string opt_label = (option.label.empty() || option.label.back() != '_') ? option.label : option.label.substr(0, option.label.size() - 1);
|
||||||
//! To correct translation by context have to use wxGETTEXT_IN_CONTEXT macro from wxWidget 3.1.1
|
//! To correct translation by context have to use wxGETTEXT_IN_CONTEXT macro from wxWidget 3.1.1
|
||||||
label = (option.label == L_CONTEXT("Top", "Layers") || option.label == L_CONTEXT("Bottom", "Layers")) ?
|
wxString label = (opt_label == L_CONTEXT("Top", "Layers") || opt_label == L_CONTEXT("Bottom", "Layers")) ?
|
||||||
_CTX(option.label, "Layers") : _(option.label);
|
_CTX(opt_label, "Layers") : _(opt_label);
|
||||||
|
bool no_dots = label.empty() || option.label.back() == '_';
|
||||||
|
if (!no_dots)
|
||||||
label += ":";
|
label += ":";
|
||||||
|
if (!label.empty()) {
|
||||||
|
int width = ctrl->opt_group->sublabel_width * ctrl->m_em_unit;
|
||||||
|
if (option.label_width >= 0) {
|
||||||
|
if (option.label_width != 0) {
|
||||||
|
width = option.label_width * ctrl->m_em_unit;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (ctrl->opt_group->label_width > 0) {
|
||||||
|
width = ctrl->opt_group->label_width * ctrl->m_em_unit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (is_url_string)
|
if (is_url_string)
|
||||||
is_url_string = false;
|
is_url_string = false;
|
||||||
else if (opt == option_set.front())
|
else if (opt == option_set.front())
|
||||||
is_url_string = !og_line.label_path.IsEmpty();
|
is_url_string = !og_line.label_path.IsEmpty();
|
||||||
h_pos = draw_text(dc, wxPoint(h_pos, v_pos), label, field ? field->label_color() : nullptr, ctrl->opt_group->sublabel_width * ctrl->m_em_unit, is_url_string);
|
h_pos = draw_text(dc, wxPoint(h_pos, v_pos), label, field ? field->label_color() : nullptr, width, is_url_string, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (field && field->undo_to_sys_bitmap()) {
|
if (field && field->undo_to_sys_bitmap()) {
|
||||||
@ -550,8 +597,8 @@ void OG_CustomCtrl::CtrlLine::render(wxDC& dc, wxCoord v_pos)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
// add sidetext if any
|
// add sidetext if any
|
||||||
if (!option.sidetext.empty() || ctrl->opt_group->sidetext_width > 0)
|
if ( (!option.sidetext.empty() || ctrl->opt_group->sidetext_width > 0 || option.sidetext_width > 0 ) && option.sidetext_width != 0)
|
||||||
h_pos = draw_text(dc, wxPoint(h_pos, v_pos), _(option.sidetext), nullptr, ctrl->opt_group->sidetext_width * ctrl->m_em_unit);
|
h_pos = draw_text(dc, wxPoint(h_pos, v_pos), _(option.sidetext), nullptr, (option.sidetext_width > 0 ? option.sidetext_width : ctrl->opt_group->sidetext_width ) * ctrl->m_em_unit);
|
||||||
|
|
||||||
if (opt.opt_id != option_set.back().opt_id) //! istead of (opt != option_set.back())
|
if (opt.opt_id != option_set.back().opt_id) //! istead of (opt != option_set.back())
|
||||||
h_pos += lround(0.6 * ctrl->m_em_unit);
|
h_pos += lround(0.6 * ctrl->m_em_unit);
|
||||||
@ -571,7 +618,7 @@ wxCoord OG_CustomCtrl::CtrlLine::draw_mode_bmp(wxDC& dc, wxCoord v_pos)
|
|||||||
return get_bitmap_size(bmp).GetWidth() + ctrl->m_h_gap;
|
return get_bitmap_size(bmp).GetWidth() + ctrl->m_h_gap;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCoord OG_CustomCtrl::CtrlLine::draw_text(wxDC& dc, wxPoint pos, const wxString& text, const wxColour* color, int width, bool is_url/* = false*/)
|
wxCoord OG_CustomCtrl::CtrlLine::draw_text(wxDC& dc, wxPoint pos, const wxString& text, const wxColour* color, int width, bool is_url/* = false*/, bool align_right/* = false*/)
|
||||||
{
|
{
|
||||||
wxString multiline_text;
|
wxString multiline_text;
|
||||||
if (width > 0 && dc.GetTextExtent(text).x > width) {
|
if (width > 0 && dc.GetTextExtent(text).x > width) {
|
||||||
@ -604,8 +651,11 @@ wxCoord OG_CustomCtrl::CtrlLine::draw_text(wxDC& dc, wxPoint pos, const wxStr
|
|||||||
dc.GetMultiLineTextExtent(out_text, &text_width, &text_height);
|
dc.GetMultiLineTextExtent(out_text, &text_width, &text_height);
|
||||||
|
|
||||||
pos.y = pos.y + lround((height - text_height) / 2);
|
pos.y = pos.y + lround((height - text_height) / 2);
|
||||||
|
wxPoint draw_pos = pos;
|
||||||
|
if (align_right && width > 0)
|
||||||
|
draw_pos.x += width - text_width;
|
||||||
if (width > 0 && is_url)
|
if (width > 0 && is_url)
|
||||||
rect_label = wxRect(pos, wxSize(text_width, text_height));
|
rect_label = wxRect(draw_pos, wxSize(text_width, text_height));
|
||||||
|
|
||||||
wxColour old_clr = dc.GetTextForeground();
|
wxColour old_clr = dc.GetTextForeground();
|
||||||
wxFont old_font = dc.GetFont();
|
wxFont old_font = dc.GetFont();
|
||||||
@ -617,7 +667,7 @@ wxCoord OG_CustomCtrl::CtrlLine::draw_text(wxDC& dc, wxPoint pos, const wxStr
|
|||||||
dc.SetFont(old_font.Bold().Underlined());
|
dc.SetFont(old_font.Bold().Underlined());
|
||||||
#endif
|
#endif
|
||||||
dc.SetTextForeground(color ? *color : wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
dc.SetTextForeground(color ? *color : wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
||||||
dc.DrawText(out_text, pos);
|
dc.DrawText(out_text, draw_pos);
|
||||||
dc.SetTextForeground(old_clr);
|
dc.SetTextForeground(old_clr);
|
||||||
dc.SetFont(old_font);
|
dc.SetFont(old_font);
|
||||||
|
|
||||||
@ -634,9 +684,10 @@ wxPoint OG_CustomCtrl::CtrlLine::draw_blinking_bmp(wxDC& dc, wxPoint pos, bool i
|
|||||||
wxCoord h_pos = pos.x;
|
wxCoord h_pos = pos.x;
|
||||||
wxCoord v_pos = pos.y + lround((height - get_bitmap_size(bmp_blinking).GetHeight()) / 2);
|
wxCoord v_pos = pos.y + lround((height - get_bitmap_size(bmp_blinking).GetHeight()) / 2);
|
||||||
|
|
||||||
|
int bmp_dim = get_bitmap_size(bmp_blinking).GetWidth();
|
||||||
|
|
||||||
dc.DrawBitmap(bmp_blinking, h_pos, v_pos);
|
dc.DrawBitmap(bmp_blinking, h_pos, v_pos);
|
||||||
|
|
||||||
int bmp_dim = get_bitmap_size(bmp_blinking).GetWidth();
|
|
||||||
|
|
||||||
h_pos += bmp_dim + ctrl->m_h_gap;
|
h_pos += bmp_dim + ctrl->m_h_gap;
|
||||||
return wxPoint(h_pos, v_pos);
|
return wxPoint(h_pos, v_pos);
|
||||||
@ -644,23 +695,28 @@ wxPoint OG_CustomCtrl::CtrlLine::draw_blinking_bmp(wxDC& dc, wxPoint pos, bool i
|
|||||||
|
|
||||||
wxCoord OG_CustomCtrl::CtrlLine::draw_act_bmps(wxDC& dc, wxPoint pos, const wxBitmap& bmp_undo_to_sys, const wxBitmap& bmp_undo, bool is_blinking, size_t rect_id)
|
wxCoord OG_CustomCtrl::CtrlLine::draw_act_bmps(wxDC& dc, wxPoint pos, const wxBitmap& bmp_undo_to_sys, const wxBitmap& bmp_undo, bool is_blinking, size_t rect_id)
|
||||||
{
|
{
|
||||||
pos = draw_blinking_bmp(dc, pos, is_blinking, rect_id);
|
|
||||||
wxCoord h_pos = pos.x;
|
wxCoord h_pos = pos.x;
|
||||||
wxCoord v_pos = pos.y;
|
wxCoord v_pos = pos.y;
|
||||||
|
|
||||||
dc.DrawBitmap(bmp_undo_to_sys, h_pos, v_pos);
|
dc.DrawBitmap(bmp_undo_to_sys, h_pos, v_pos + 5);
|
||||||
|
|
||||||
int bmp_dim = get_bitmap_size(bmp_undo_to_sys).GetWidth();
|
int bmp_dim = get_bitmap_size(bmp_undo_to_sys).GetWidth();
|
||||||
rects_undo_to_sys_icon[rect_id] = wxRect(h_pos, v_pos, bmp_dim, bmp_dim);
|
rects_undo_to_sys_icon[rect_id] = wxRect(h_pos, v_pos, bmp_dim, bmp_dim);
|
||||||
|
|
||||||
h_pos += bmp_dim + ctrl->m_h_gap;
|
h_pos += bmp_dim + ctrl->m_h_gap;
|
||||||
dc.DrawBitmap(bmp_undo, h_pos, v_pos);
|
dc.DrawBitmap(bmp_undo, h_pos, v_pos + 5);
|
||||||
|
|
||||||
bmp_dim = get_bitmap_size(bmp_undo).GetWidth();
|
bmp_dim = get_bitmap_size(bmp_undo).GetWidth();
|
||||||
rects_undo_icon[rect_id] = wxRect(h_pos, v_pos, bmp_dim, bmp_dim);
|
rects_undo_icon[rect_id] = wxRect(h_pos, v_pos, bmp_dim, bmp_dim);
|
||||||
|
|
||||||
|
if(is_blinking)
|
||||||
|
draw_blinking_bmp(dc, wxPoint(h_pos, v_pos), is_blinking, rect_id);
|
||||||
|
|
||||||
h_pos += bmp_dim + ctrl->m_h_gap;
|
h_pos += bmp_dim + ctrl->m_h_gap;
|
||||||
|
|
||||||
|
if (is_blinking)
|
||||||
|
draw_blinking_bmp(dc, wxPoint(h_pos, v_pos), is_blinking, rect_id);
|
||||||
|
|
||||||
return h_pos;
|
return h_pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,8 @@ class OG_CustomCtrl :public wxPanel
|
|||||||
const Line& og_line;
|
const Line& og_line;
|
||||||
|
|
||||||
bool draw_just_act_buttons { false };
|
bool draw_just_act_buttons { false };
|
||||||
bool is_visible { true };
|
std::vector<bool> is_visible;
|
||||||
|
bool is_line_visible { true };
|
||||||
bool is_focused { false };
|
bool is_focused { false };
|
||||||
|
|
||||||
CtrlLine( wxCoord height,
|
CtrlLine( wxCoord height,
|
||||||
@ -54,7 +55,7 @@ class OG_CustomCtrl :public wxPanel
|
|||||||
|
|
||||||
void render(wxDC& dc, wxCoord v_pos);
|
void render(wxDC& dc, wxCoord v_pos);
|
||||||
wxCoord draw_mode_bmp(wxDC& dc, wxCoord v_pos);
|
wxCoord draw_mode_bmp(wxDC& dc, wxCoord v_pos);
|
||||||
wxCoord draw_text (wxDC& dc, wxPoint pos, const wxString& text, const wxColour* color, int width, bool is_url = false);
|
wxCoord draw_text (wxDC& dc, wxPoint pos, const wxString& text, const wxColour* color, int width, bool is_url = false, bool align_right = false);
|
||||||
wxPoint draw_blinking_bmp(wxDC& dc, wxPoint pos, bool is_blinking, size_t rect_id = 0);
|
wxPoint draw_blinking_bmp(wxDC& dc, wxPoint pos, bool is_blinking, size_t rect_id = 0);
|
||||||
wxCoord draw_act_bmps(wxDC& dc, wxPoint pos, const wxBitmap& bmp_undo_to_sys, const wxBitmap& bmp_undo, bool is_blinking, size_t rect_id = 0);
|
wxCoord draw_act_bmps(wxDC& dc, wxPoint pos, const wxBitmap& bmp_undo_to_sys, const wxBitmap& bmp_undo, bool is_blinking, size_t rect_id = 0);
|
||||||
bool launch_browser() const;
|
bool launch_browser() const;
|
||||||
|
@ -166,9 +166,9 @@ void OptionsGroup::append_line(const Line& line)
|
|||||||
m_options.emplace(opt.opt_id, opt);
|
m_options.emplace(opt.opt_id, opt);
|
||||||
|
|
||||||
// add mode value for current line to m_options_mode
|
// add mode value for current line to m_options_mode
|
||||||
m_options_mode.emplace_back();
|
|
||||||
m_line_sizer.emplace_back();
|
|
||||||
if (!option_set.empty()){
|
if (!option_set.empty()){
|
||||||
|
m_line_sizer.emplace_back();
|
||||||
|
m_options_mode.emplace_back();
|
||||||
m_options_mode.back()[option_set[0].opt.mode].push_back(-1);
|
m_options_mode.back()[option_set[0].opt.mode].push_back(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -320,12 +320,14 @@ void OptionsGroup::activate_line(Line& line)
|
|||||||
// add label if any
|
// add label if any
|
||||||
if (!option.label.empty() && !custom_ctrl) {
|
if (!option.label.empty() && !custom_ctrl) {
|
||||||
//! To correct translation by context have to use wxGETTEXT_IN_CONTEXT macro from wxWidget 3.1.1
|
//! To correct translation by context have to use wxGETTEXT_IN_CONTEXT macro from wxWidget 3.1.1
|
||||||
std::string opt_label = (option.label.at(option.label.size() - 1) != '_') ? option.label : option.label.substr(0, option.label.size() - 1);
|
std::string opt_label = (option.label.empty() || option.label.back() != '_') ? option.label : option.label.substr(0, option.label.size() - 1);
|
||||||
wxString str_label = (opt_label == L_CONTEXT("Top", "Layers") || opt_label == L_CONTEXT("Bottom", "Layers")) ?
|
wxString str_label = (opt_label == L_CONTEXT("Top", "Layers") || opt_label == L_CONTEXT("Bottom", "Layers")) ?
|
||||||
_CTX(opt_label, "Layers") :
|
_CTX(opt_label, "Layers") :
|
||||||
_(opt_label);
|
_(opt_label);
|
||||||
|
|
||||||
|
bool no_dots = str_label.empty() || option.label.back() == '_';
|
||||||
label = new wxStaticText(this->ctrl_parent(), wxID_ANY,
|
label = new wxStaticText(this->ctrl_parent(), wxID_ANY,
|
||||||
(str_label.empty() ? "" : (str_label + ":")), wxDefaultPosition, //wxDefaultSize);
|
(no_dots ? "" : (str_label + ":")), wxDefaultPosition, //wxDefaultSize);
|
||||||
(option.label_width >= 0) ? ((option.label_width != 0) ? wxSize(option.label_width*wxGetApp().em_unit(), -1) : wxDefaultSize) :
|
(option.label_width >= 0) ? ((option.label_width != 0) ? wxSize(option.label_width*wxGetApp().em_unit(), -1) : wxDefaultSize) :
|
||||||
((label_width > 0) ? wxSize(label_width * wxGetApp().em_unit(), -1) : (wxDefaultSize))
|
((label_width > 0) ? wxSize(label_width * wxGetApp().em_unit(), -1) : (wxDefaultSize))
|
||||||
, wxALIGN_RIGHT);
|
, wxALIGN_RIGHT);
|
||||||
@ -359,7 +361,7 @@ void OptionsGroup::activate_line(Line& line)
|
|||||||
sizer_tmp->Add(field->getWindow(), 0, wxALIGN_CENTER_VERTICAL, 0);
|
sizer_tmp->Add(field->getWindow(), 0, wxALIGN_CENTER_VERTICAL, 0);
|
||||||
|
|
||||||
// add sidetext if any
|
// add sidetext if any
|
||||||
if (!option.sidetext.empty() || sidetext_width > 0) {
|
if ((!option.sidetext.empty() || sidetext_width > 0) && option.sidetext_width != 0){
|
||||||
wxString textstring;
|
wxString textstring;
|
||||||
if(!option.sidetext.empty())
|
if(!option.sidetext.empty())
|
||||||
if (option.sidetext.at(option.sidetext.size() - 1) != '_') {
|
if (option.sidetext.at(option.sidetext.size() - 1) != '_') {
|
||||||
@ -380,6 +382,7 @@ void OptionsGroup::activate_line(Line& line)
|
|||||||
sidetext->SetFont(wxGetApp().normal_font());
|
sidetext->SetFont(wxGetApp().normal_font());
|
||||||
m_options_mode.back()[opt.opt.mode].push_back(sizer_tmp->GetItemCount());
|
m_options_mode.back()[opt.opt.mode].push_back(sizer_tmp->GetItemCount());
|
||||||
sizer_tmp->Add(sidetext, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 4);
|
sizer_tmp->Add(sidetext, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 4);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// add side widget if any
|
// add side widget if any
|
||||||
|
@ -180,12 +180,7 @@ public:
|
|||||||
|
|
||||||
void clear_fields_except_of(const std::vector<std::string> left_fields);
|
void clear_fields_except_of(const std::vector<std::string> left_fields);
|
||||||
|
|
||||||
void hide_labels() {
|
void hide_labels() { label_width = 0; title_width = 0;}
|
||||||
title_width = 0;
|
|
||||||
// del from 2.3
|
|
||||||
//m_grid_sizer->SetCols(m_grid_sizer->GetEffectiveColsCount()-1);
|
|
||||||
//static_cast<wxFlexGridSizer*>(m_grid_sizer)->AddGrowableCol(!extra_column ? 0 : 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
OptionsGroup( wxWindow* _parent, const wxString& title, bool is_tab_opt = false,
|
OptionsGroup( wxWindow* _parent, const wxString& title, bool is_tab_opt = false,
|
||||||
column_t extra_clmn = nullptr);
|
column_t extra_clmn = nullptr);
|
||||||
@ -197,6 +192,8 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
std::map<t_config_option_key, Option> m_options;
|
std::map<t_config_option_key, Option> m_options;
|
||||||
wxWindow* m_parent {nullptr};
|
wxWindow* m_parent {nullptr};
|
||||||
|
// vector: an entry per line
|
||||||
|
//map : mode -> items idx in the line
|
||||||
std::vector<std::map<ConfigOptionMode, std::vector<size_t>>> m_options_mode;
|
std::vector<std::map<ConfigOptionMode, std::vector<size_t>>> m_options_mode;
|
||||||
std::vector<wxSizer*> m_line_sizer;
|
std::vector<wxSizer*> m_line_sizer;
|
||||||
std::vector<wxWindow*> m_extra_column_item_ptrs;
|
std::vector<wxWindow*> m_extra_column_item_ptrs;
|
||||||
|
@ -1930,6 +1930,8 @@ bool Tab::create_pages(std::string setting_type_name, int idx_page)
|
|||||||
TabPrinter* tab = nullptr;
|
TabPrinter* tab = nullptr;
|
||||||
if ((tab = dynamic_cast<TabPrinter*>(this)) == nullptr) continue;
|
if ((tab = dynamic_cast<TabPrinter*>(this)) == nullptr) continue;
|
||||||
widget_t reset_to_filament_color = [this, idx_page, tab](wxWindow* parent) -> wxBoxSizer* {
|
widget_t reset_to_filament_color = [this, idx_page, tab](wxWindow* parent) -> wxBoxSizer* {
|
||||||
|
tab->m_reset_to_filament_color = new ScalableButton(parent, wxID_ANY, "undo", _L("Reset to Filament Color"),
|
||||||
|
wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT, true);
|
||||||
ScalableButton* btn = tab->m_reset_to_filament_color;
|
ScalableButton* btn = tab->m_reset_to_filament_color;
|
||||||
btn->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
btn->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||||
btn->SetSize(btn->GetBestSize());
|
btn->SetSize(btn->GetBestSize());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user