Skip to content

Commit 0dccf4d

Browse files
committed
Remove the change label width popup menu (#1964)
It was not working at all and caused crashes. And I think the label width is not changed so often, so that a (working) possibility in the configuration menu is enough. Changed the numbers 3, 10, where nobody knows, why they are there to readable #defines LABELWIDTH_MIN and LABELWIDTH_MAX
1 parent 5dd5811 commit 0dccf4d

File tree

7 files changed

+21
-7
lines changed

7 files changed

+21
-7
lines changed

NEWS.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# Current development version
2+
3+
- Remove the change label witdth popup menu (#1964)
4+
It was not working at all and caused crashes. And I think the
5+
label width is not changed so often, so that a (working)
6+
possibility in the configuration menu is enough.
7+
18
# 24.11.0
29

310
- A Spanish translation update by cyphra.

src/Configuration.h

+3
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@
6565
static constexpr AFontSize MC_MIN_SIZE{ 6.0f };
6666
static constexpr AFontSize MC_MAX_SIZE{ 48.0f };
6767

68+
// The minimal and maximal label width
69+
#define LABELWIDTH_MIN 3
70+
#define LABELWIDTH_MAX 10
6871
class Cell;
6972

7073
/*! The configuration storage for the current worksheet.

src/EventIDs.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
This file defines the class EventIDs that contains unique IDs for many events
2525
wxMaxima needs.
2626
*/
27+
#include "Configuration.h"
2728
#include "EventIDs.h"
2829
#include <wx/utils.h>
2930
#include <wx/window.h>
@@ -613,7 +614,7 @@ const wxWindowIDRef EventIDs::popid_labels_useronly(wxWindow::NewControlId());
613614
const wxWindowIDRef EventIDs::popid_labels_autogenerated(wxWindow::NewControlId());
614615
const wxWindowIDRef EventIDs::popid_inputlabels_hide(wxWindow::NewControlId());
615616
const wxWindowIDRef EventIDs::popid_labelwidth(wxWindow::NewControlId());
616-
const wxWindowIDRef EventIDs::popid_labelwidth1(wxWindow::NewControlId(NumberOfLabelWidths()));
617+
const wxWindowIDRef EventIDs::popid_labelwidth1(wxWindow::NewControlId(LABELWIDTH_MAX - LABELWIDTH_MIN));
617618
const wxWindowIDRef EventIDs::popid_digits_20(wxWindow::NewControlId());
618619
const wxWindowIDRef EventIDs::popid_digits_50(wxWindow::NewControlId());
619620
const wxWindowIDRef EventIDs::popid_digits_100(wxWindow::NewControlId());

src/EventIDs.h

-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ class EventIDs
5555
static constexpr int NumberOfRecentFiles() {return 30;}
5656
//! How many IDs we have reserved for suggestions of similar command names?
5757
static constexpr int NumberOfSuggestions() {return 10;}
58-
//! How many IDs we have reserved for label width choices?
59-
static constexpr int NumberOfLabelWidths() {return 10;}
6058
//! How many IDs have we reserved for table of contents depths
6159
static constexpr int NumberOfTocLevels() {return 6;}
6260
/*! @{

src/Worksheet.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -1628,8 +1628,12 @@ void Worksheet::OnMouseRightDown(wxMouseEvent &event) {
16281628
popupMenu.Check(EventIDs::popid_labels_disable,
16291629
m_configuration->GetLabelChoice() ==
16301630
Configuration::labels_none);
1631+
/***********************
1632+
Label width popup menu commented out.
1633+
(a) does not work at all. Selections here have no influence.
1634+
(b) Source of the issue: https://github.com/wxMaxima-developers/wxmaxima/issues/1964
16311635
wxMenu *labelWidthMenu = new wxMenu();
1632-
for(int i = 3; i < EventIDs::NumberOfLabelWidths(); i++)
1636+
for(int i = LABELWIDTH_MIN; i <= LABELWIDTH_MAX; i++)
16331637
{
16341638
labelWidthMenu->AppendRadioItem(EventIDs::popid_labelwidth1 + i,
16351639
wxString::Format(wxS("%li em"),
@@ -1638,6 +1642,7 @@ void Worksheet::OnMouseRightDown(wxMouseEvent &event) {
16381642
labelWidthMenu->Check(EventIDs::popid_labelwidth1 + i, true);
16391643
}
16401644
popupMenu.Append(EventIDs::popid_labelwidth, _("Label width"), labelWidthMenu);
1645+
************************/
16411646
}
16421647
}
16431648

src/dialogs/ConfigDialogue.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ wxWindow *ConfigDialogue::CreateWorksheetPanel() {
678678
wxUP | wxDOWN | wxALIGN_CENTER_VERTICAL);
679679
m_labelWidth = new wxSpinCtrl(
680680
displaySizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition,
681-
wxSize(150 * GetContentScaleFactor(), -1), wxSP_ARROW_KEYS, 3, 10);
681+
wxSize(150 * GetContentScaleFactor(), -1), wxSP_ARROW_KEYS, LABELWIDTH_MIN, LABELWIDTH_MAX);
682682
grid_sizer->Add(m_labelWidth, 0, wxUP | wxDOWN, 5 * GetContentScaleFactor());
683683

684684
grid_sizer->Add(

src/wxMaxima.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1249,7 +1249,7 @@ wxMaxima::wxMaxima(wxWindow *parent, int id,
12491249
NULL, this);
12501250
Connect(EventIDs::menu_zoom_300, wxEVT_MENU, wxCommandEventHandler(wxMaxima::EditMenu),
12511251
NULL, this);
1252-
Connect(EventIDs::popid_labelwidth1, EventIDs::popid_labelwidth1 + EventIDs::NumberOfLabelWidths() - 1,
1252+
Connect(EventIDs::popid_labelwidth1, EventIDs::popid_labelwidth1 + LABELWIDTH_MAX - LABELWIDTH_MIN,
12531253
wxEVT_MENU, wxCommandEventHandler(wxMaxima::EditMenu), NULL, this);
12541254
Connect(EventIDs::popid_digits_all, wxEVT_MENU,
12551255
wxCommandEventHandler(wxMaxima::EditMenu), NULL, this);
@@ -6279,7 +6279,7 @@ void wxMaxima::EditMenu(wxCommandEvent &event) {
62796279

62806280
wxString expr = GetDefaultEntry();
62816281
if(((event.GetId()) >= EventIDs::popid_labelwidth1) &&
6282-
((event.GetId()) < EventIDs::popid_labelwidth1 + EventIDs::NumberOfLabelWidths())){
6282+
((event.GetId()) < EventIDs::popid_labelwidth1 + LABELWIDTH_MAX - LABELWIDTH_MIN)) {
62836283
m_configuration.LabelWidth(EventIDs::popid_labelwidth1 + 1 - event.GetId());
62846284
GetWorksheet()->Recalculate();
62856285
GetWorksheet()->RequestRedraw();

0 commit comments

Comments
 (0)