Skip to content

Commit

Permalink
knob dialog: 'Steps' is only active if either discrete or ticks toggl…
Browse files Browse the repository at this point in the history
…es are enabled!
  • Loading branch information
porres committed Nov 22, 2024
1 parent aab699d commit d862a2e
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions Source/Extra/knob_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,27 @@ sys_gui("\n"
"}\n"
"\n"

"proc ::dialog_elsegui::discrete_check {id} {\n"
" set vid [string trimleft $id .]\n"
" if { $::dialog_elsegui::var_discrete($vid) == 0 && $::dialog_elsegui::var_showticks($vid) == 0 } {\n"
" $id.discrete.steps.ent configure -state disabled\n"
" } else {\n"
" $id.discrete.steps.ent configure -state normal\n"
" }\n"
"}\n"
"\n"

"proc ::dialog_elsegui::ticks_check {id} {\n"
" set vid [string trimleft $id .]\n"
" if { $::dialog_elsegui::var_discrete($vid) == 0 && $::dialog_elsegui::var_showticks($vid) == 0 } {\n"
" $id.discrete.steps.ent configure -state disabled\n"
" } else {\n"
" $id.discrete.steps.ent configure -state normal\n"
" }\n"
" ::dialog_elsegui::apply $id\n"
"}\n"
"\n"

// Get parameters from Pd when asking for properties!
"proc knob_dialog {id \\\n"
" size square \\\n"
Expand Down Expand Up @@ -224,19 +245,24 @@ sys_gui("\n"
// Checkbox for discrete mode
" frame $id.discrete.mode\n"
" label $id.discrete.mode.lab -text [_ \"Discrete mode: \"]\n"
" checkbutton $id.discrete.mode.ent -variable ::dialog_elsegui::var_discrete($vid) -width 5\n"
" checkbutton $id.discrete.mode.ent -variable ::dialog_elsegui::var_discrete($vid) -width 5\\\n"
" -command [concat ::dialog_elsegui::discrete_check $id]\n"
" pack $id.discrete.mode.ent $id.discrete.mode.lab -side right -anchor e\n"
// Checkbox for show ticks
" frame $id.discrete.ticks\n"
" label $id.discrete.ticks.lab -text [_ \"Show ticks: \"]\n"
" checkbutton $id.discrete.ticks.ent -variable ::dialog_elsegui::var_showticks($vid) -width 5\\\n"
" -command [concat ::dialog_elsegui::apply $id]\n"
" -command [concat ::dialog_elsegui::ticks_check $id]\n"
" pack $id.discrete.ticks.ent $id.discrete.ticks.lab -side right -anchor e\n"
// Entry for number of steps
" frame $id.discrete.steps\n"
" label $id.discrete.steps.lab -text [_ \"Steps: \"]\n"
" entry $id.discrete.steps.ent -textvariable ::dialog_elsegui::var_steps($vid) -width 3\n"
" pack $id.discrete.steps.ent $id.discrete.steps.lab -side right -anchor e\n"
// When discrete and ticks aren't checked, disable steps box
" if { $::dialog_elsegui::var_discrete($vid) == 0 && $::dialog_elsegui::var_showticks($vid) == 0 } {\n"
" $id.discrete.steps.ent configure -state disabled\n"
" }\n"
// Position of items
" pack $id.discrete.mode $id.discrete.ticks $id.discrete.steps -side left -anchor center\n"
" $id.discrete config -padx 30\n"
Expand Down

0 comments on commit d862a2e

Please sign in to comment.