Skip to content

Commit

Permalink
upgrade to auto-wrapping of const char*
Browse files Browse the repository at this point in the history
  • Loading branch information
jafl committed Dec 28, 2023
1 parent a88e793 commit aec9901
Show file tree
Hide file tree
Showing 240 changed files with 1,550 additions and 863 deletions.
2 changes: 1 addition & 1 deletion libj2dplot/code/J2DPlotWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4405,7 +4405,7 @@ J2DPlotWidget::DrawCursorLabels
}
JSize labelHeight = p.GetLineHeight();
JSize cursorHeight = GetCursorLabelHeight(p);
JSize strwidth = p.GetStringWidth(JString("x1 = 0000000000", JString::kNoCopy));
JSize strwidth = p.GetStringWidth("x1 = 0000000000");
JSize totalWidth = 3 * strwidth + 2 * kCursorValueBuffer;
JSize axisWidth = itsXAxisEnd - itsXAxisStart;
JCoordinate startx = itsXAxisStart;
Expand Down
19 changes: 19 additions & 0 deletions libj2dplot/code/JX2DPlotWidget-Cursor-enum.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// This file was automatically generated by jx_menu_editor.
// Do not edit it directly!
// Any changes you make will be silently overwritten.

#ifndef _H_JX2DPlotWidget_Cursor_enum
#define _H_JX2DPlotWidget_Cursor_enum

enum {
kXCursorCmd=1,
kYCursorCmd,
kDualCursorsCmd,
kMarkCursorCmd,
kMarkAllVisCursorsCmd,
kRemoveMarkIndex,
kRemoveAllMarksCmd,
kShowMarkWindowCmd,
};

#endif
15 changes: 3 additions & 12 deletions libj2dplot/code/JX2DPlotWidget-Cursor.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,12 @@ static const JUtf8Byte* kCursorMenuStr =
"|* %i __ShowMarkWindow::JX2DPlotWidget"
;

enum {
kXCursorCmd=1,
kYCursorCmd,
kDualCursorsCmd,
kMarkCursorCmd,
kMarkAllVisCursorsCmd,
kRemoveMarkIndex,
kRemoveAllMarksCmd,
kShowMarkWindowCmd,
};
#include "JX2DPlotWidget-Cursor-enum.h"


static void ConfigureCursorMenu(JXTextMenu* menu, const int offset = 0) {
if (menu->IsEmpty() && JXMenu::GetDisplayStyle() == JXMenu::kWindowsStyle) {
menu->SetShortcuts(JString("#c", JString::kNoCopy));
if (offset == 0 && JXMenu::GetDisplayStyle() == JXMenu::kWindowsStyle) {
menu->SetShortcuts("#c");
}
};

Expand Down
10 changes: 5 additions & 5 deletions libj2dplot/code/JX2DPlotWidget-Cursor.jxm
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
jx_menu_editor 0
670 300
791 305
"JX2DPlotWidget"
"Cursor"
'c
40
40
148
100
100
100
100
100
43
156
160
75

0
Expand Down
20 changes: 20 additions & 0 deletions libj2dplot/code/JX2DPlotWidget-CurveOptions-enum.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// This file was automatically generated by jx_menu_editor.
// Do not edit it directly!
// Any changes you make will be silently overwritten.

#ifndef _H_JX2DPlotWidget_CurveOptions_enum
#define _H_JX2DPlotWidget_CurveOptions_enum

enum {
kToggleCurveVisibleCmd=1,
kShowAllCurvesCmd,
kHideAllOtherCurvesCmd,
kPointsCmd,
kSymbolsCmd,
kLinesCmd,
kLinesSymbolsCmd,
kXErrorsCmd,
kYErrorsCmd,
};

#endif
12 changes: 1 addition & 11 deletions libj2dplot/code/JX2DPlotWidget-CurveOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,7 @@ static const JUtf8Byte* kCurveOptionsMenuStr =
"|* %b %i __YErrors::JX2DPlotWidget"
;

enum {
kToggleCurveVisibleCmd=1,
kShowAllCurvesCmd,
kHideAllOtherCurvesCmd,
kPointsCmd,
kSymbolsCmd,
kLinesCmd,
kLinesSymbolsCmd,
kXErrorsCmd,
kYErrorsCmd,
};
#include "JX2DPlotWidget-CurveOptions-enum.h"


static void ConfigureCurveOptionsMenu(JXTextMenu* menu, const int offset = 0) {
Expand Down
10 changes: 5 additions & 5 deletions libj2dplot/code/JX2DPlotWidget-CurveOptions.jxm
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
jx_menu_editor 0
671 327
718 324
"JX2DPlotWidget"
"CurveOptions"
'
40
40
117
100
100
100
100
100
40
107
170
75

0
Expand Down
22 changes: 22 additions & 0 deletions libj2dplot/code/JX2DPlotWidget-Options-enum.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// This file was automatically generated by jx_menu_editor.
// Do not edit it directly!
// Any changes you make will be silently overwritten.

#ifndef _H_JX2DPlotWidget_Options_enum
#define _H_JX2DPlotWidget_Options_enum

enum {
kScaleCmd=1,
kResetScaleCmd,
kShowFrameCmd,
kShowGridCmd,
kShowLegendCmd,
kCopyScaleToRangeCmd,
kChangeRangeCmd,
kClearRangeCmd,
kChangeLabelsCmd,
kCurveOptionsCmd,
kRemoveCurveCmd,
};

#endif
18 changes: 3 additions & 15 deletions libj2dplot/code/JX2DPlotWidget-Options.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,12 @@ static const JUtf8Byte* kOptionsMenuStr =
"|* %i __RemoveCurve::JX2DPlotWidget"
;

enum {
kScaleCmd=1,
kResetScaleCmd,
kShowFrameCmd,
kShowGridCmd,
kShowLegendCmd,
kCopyScaleToRangeCmd,
kChangeRangeCmd,
kClearRangeCmd,
kChangeLabelsCmd,
kCurveOptionsCmd,
kRemoveCurveCmd,
};
#include "JX2DPlotWidget-Options-enum.h"


static void ConfigureOptionsMenu(JXTextMenu* menu, const int offset = 0) {
if (menu->IsEmpty() && JXMenu::GetDisplayStyle() == JXMenu::kWindowsStyle) {
menu->SetShortcuts(JString("#o", JString::kNoCopy));
if (offset == 0 && JXMenu::GetDisplayStyle() == JXMenu::kWindowsStyle) {
menu->SetShortcuts("#o");
}
};

Expand Down
10 changes: 5 additions & 5 deletions libj2dplot/code/JX2DPlotWidget-Options.jxm
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
jx_menu_editor 0
671 373
809 367
"JX2DPlotWidget"
"Options"
'o
40
40
155
100
100
100
100
100
44
157
169
75

0
Expand Down
16 changes: 16 additions & 0 deletions libj2dplot/testui/code/PlotDirector-Actions-enum.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// This file was automatically generated by jx_menu_editor.
// Do not edit it directly!
// Any changes you make will be silently overwritten.

#ifndef _H_PlotDirector_Actions_enum
#define _H_PlotDirector_Actions_enum

enum {
kPSPageSetupCmd=1,
kPrintPSCmd,
kPrintPlotEPSCmd,
kPrintMarksEPSCmd,
kQuitCmd,
};

#endif
12 changes: 3 additions & 9 deletions libj2dplot/testui/code/PlotDirector-Actions.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,16 @@ static const JUtf8Byte* kActionsMenuStr =
"|* %i __Quit::PlotDirector"
;

enum {
kPSPageSetupCmd=1,
kPrintPSCmd,
kPrintPlotEPSCmd,
kPrintMarksEPSCmd,
kQuitCmd,
};
#include "PlotDirector-Actions-enum.h"

#ifndef _H_jx_af_image_jx_jx_file_print
#define _H_jx_af_image_jx_jx_file_print
#include <jx-af/image/jx/jx_file_print.xpm>
#endif

static void ConfigureActionsMenu(JXTextMenu* menu, const int offset = 0) {
if (menu->IsEmpty() && JXMenu::GetDisplayStyle() == JXMenu::kWindowsStyle) {
menu->SetShortcuts(JString("#a", JString::kNoCopy));
if (offset == 0 && JXMenu::GetDisplayStyle() == JXMenu::kWindowsStyle) {
menu->SetShortcuts("#a");
}
menu->SetItemImage(kPrintPSCmd + offset, jx_file_print);
};
Expand Down
8 changes: 4 additions & 4 deletions libj2dplot/testui/code/PlotDirector-Actions.jxm
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
jx_menu_editor 0
670 300
764 249
"PlotDirector"
"Actions"
'a
40
40
153
100
100
100
100
36
154
140
75

0
Expand Down
10 changes: 5 additions & 5 deletions libj2dplot/testui/code/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ TestData
ok = data->SetYErrors(yPErr, yMErr);
assert( ok );

plot->AddCurve(data, true, JString("sin(x)", JString::kNoCopy), true, true);
plot->AddCurve(data, true, "sin(x)", true, true);

x.RemoveAll();
y.RemoveAll();
Expand All @@ -114,7 +114,7 @@ TestData
}

JIndex i;
plot->AddCurve(x, y, false, JString("cos(x)", JString::kNoCopy), &i, true, false);
plot->AddCurve(x, y, false, "cos(x)", &i, true, false);

plot->SetTitle(JGetString("DataTitle::main"));
}
Expand Down Expand Up @@ -145,7 +145,7 @@ TestLogData
}

JIndex i;
plot->AddCurve(x, y, false, JString("log2(x)", JString::kNoCopy), &i, true, false);
plot->AddCurve(x, y, false, "log2(x)", &i, true, false);

x.RemoveAll();
y.RemoveAll();
Expand All @@ -156,7 +156,7 @@ TestLogData
y.AppendItem((i*delta)*(i*delta));
}

plot->AddCurve(x, y, false, JString("x^2", JString::kNoCopy), &i, true, false);
plot->AddCurve(x, y, false, "x^2", &i, true, false);

plot->SetYScale(0.1, 1000, 0, false);
plot->SetTitle(JGetString("LogDataTitle::main"));
Expand Down Expand Up @@ -188,7 +188,7 @@ TestVector
data->AddElement(0.8+x, 5.0+y, x,y);
}

plot->AddCurve(data, true, JString("vector", JString::kNoCopy));
plot->AddCurve(data, true, "vector");

plot->SetTitle(JGetString("VectorTitle::main"));
}
Expand Down
4 changes: 2 additions & 2 deletions libjcore/code/JFileArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
#include "jStreamUtil.h"
#include "jFileUtil.h"
#include "jDirUtil.h"
#include "JMinMax.h"
#include "jGlobals.h"
#include "jAssert.h"

const JFileVersion JFileArray::kInitialVersion = 0;
Expand Down Expand Up @@ -381,7 +381,7 @@ JFileArray::OKToCreateEmbedded
}
else if (!fileIndex->EmbeddedFileIsClosed(index))
{
return FileAlreadyOpen(JString("embedded file", JString::kNoCopy));
return FileAlreadyOpen(JGetString("EmbeddedFile::JFileArray"));
}
}

Expand Down
4 changes: 2 additions & 2 deletions libjcore/code/JSpellChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ JSpellChecker::JSpellChecker()
}

int toFD, fromFD;
JError err = JProcess::Create(&itsProcess, JString("aspell -a", JString::kNoCopy),
JError err = JProcess::Create(&itsProcess, "aspell -a",
kJCreatePipe, &toFD,
kJCreatePipe, &fromFD,
kJTossOutput, nullptr);
if (!err.OK())
{
err = JProcess::Create(&itsProcess, JString("ispell -a", JString::kNoCopy),
err = JProcess::Create(&itsProcess, "ispell -a",
kJCreatePipe, &toFD,
kJCreatePipe, &fromFD,
kJTossOutput, nullptr);
Expand Down
5 changes: 3 additions & 2 deletions libjcore/code/JString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@
#include "jAssert.h"

JSize JString::theDefaultMinLgSize = 5; // 2^5 = 32 bytes
const JString JString::empty("", JString::kNoCopy);
const JString JString::newline("\n", JString::kNoCopy);
const JString JString::empty("");
const JString JString::space(" ");
const JString JString::newline("\n");

static thread_local JString* theCurrentlyConstructingObject;
static thread_local UCollator* theCaseSensitiveCollator;
Expand Down
1 change: 1 addition & 0 deletions libjcore/code/JString.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class JString
};

static const JString empty;
static const JString space;
static const JString newline;

public:
Expand Down
6 changes: 3 additions & 3 deletions libjcore/code/jGlobals_UNIX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ JGetDataDirectories
{
if (systemDataFileDir.IsEmpty())
{
if (JProgramAvailable(JString("brew", JString::kNoCopy)))
if (JProgramAvailable("brew"))
{
const JUtf8Byte* argv[] = { "brew", "--prefix", nullptr };
JProcess* p;
Expand All @@ -67,11 +67,11 @@ JGetDataDirectories
else
{
JString s1, s2;
const JError err = JGetSymbolicLinkTarget(JString("/proc/self/exe", JString::kNoCopy), &s1);
const JError err = JGetSymbolicLinkTarget("/proc/self/exe", &s1);
if (err.OK())
{
JSplitPathAndName(s1, &systemDataFileDir, &s2);
systemDataFileDir = JCombinePathAndName(systemDataFileDir, JString("..", JString::kNoCopy));
systemDataFileDir = JCombinePathAndName(systemDataFileDir, "..");
systemDataFileDir = JCombinePathAndName(systemDataFileDir, kSystemDataFileDir);
}
}
Expand Down
Loading

0 comments on commit aec9901

Please sign in to comment.