-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSidebar.cpp
More file actions
632 lines (506 loc) · 16.1 KB
/
Sidebar.cpp
File metadata and controls
632 lines (506 loc) · 16.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
/*
* Copyright 2025, Johan Wagenheim <johan@dospuntos.no>
* All rights reserved. Distributed under the terms of the MIT license.
*/
#include "Sidebar.h"
#include "Constants.h"
#include <Alert.h>
#include <Box.h>
#include <Button.h>
#include <Catalog.h>
#include <GridLayoutBuilder.h>
#include <GroupView.h>
#include <LayoutBuilder.h>
#include <RadioButton.h>
#include <StringView.h>
#include <TabView.h>
#include <TextControl.h>
#include <Window.h>
#include <cstdio>
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "Sidebar"
Sidebar::Sidebar()
:
BTabView("Sidebar")
{
// === Create tabs ===
_BuildLineTab();
_BuildPrefixTab();
_BuildSortTab();
}
void
Sidebar::MessageReceived(BMessage* msg)
{
switch (msg->what) {
case M_MODE_REMOVE_ALL:
fWordWrapCheck->SetEnabled(false);
fBreakInput->SetEnabled(false);
fKeepDelimiterCheck->SetEnabled(false);
fBreakOnChars->SetEnabled(false);
this->Invalidate();
fBreakMode = BREAK_REMOVE_ALL;
break;
case M_MODE_BREAK_ON:
fWordWrapCheck->SetEnabled(false);
fBreakInput->SetEnabled(true);
fBreakInput->MakeFocus(true);
fKeepDelimiterCheck->SetEnabled(true);
fBreakOnChars->SetEnabled(false);
this->Invalidate();
fBreakMode = BREAK_ON;
break;
case M_MODE_REPLACE_LINE_BREAKS:
fWordWrapCheck->SetEnabled(false);
fBreakInput->SetEnabled(true);
fBreakInput->MakeFocus(true);
fKeepDelimiterCheck->SetEnabled(false);
fBreakOnChars->SetEnabled(false);
this->Invalidate();
fBreakMode = BREAK_REPLACE;
break;
case M_MODE_BREAK_AFTER_CHARS:
fWordWrapCheck->SetEnabled(true);
fBreakInput->SetEnabled(false);
fKeepDelimiterCheck->SetEnabled(false);
fBreakOnChars->SetEnabled(true);
fBreakOnChars->MakeFocus(true);
fBreakMode = BREAK_AFTER_CHARS;
this->Invalidate();
break;
default:
BView::MessageReceived(msg);
break;
}
}
void
Sidebar::_BuildLineTab()
{
// === Search/Replace Box ===
BBox* searchReplaceBox = new BBox("SearchReplaceBox");
searchReplaceBox->SetLabel(B_TRANSLATE("Search and replace"));
fSearchInput = new BTextControl("SearchString",
B_TRANSLATE_COMMENT("Search:", "As short as possible"), "", nullptr);
fReplaceInput = new BTextControl("ReplaceString",
B_TRANSLATE_COMMENT("Replace:", "As short as possible"), "", nullptr);
fCaseCheck = new BCheckBox("ReplaceCaseSensitiveCheckbox",
B_TRANSLATE_COMMENT("Case sensitive", "As short as possible"), nullptr);
fWholeWordCheck = new BCheckBox("ReplaceFullWordsCheckbox",
B_TRANSLATE_COMMENT("Full words", "As short as possible"), nullptr);
BButton* searchReplaceBtn = new BButton("SearchReplaceBtn", B_TRANSLATE("Replace"),
new BMessage(M_TRANSFORM_REPLACE));
searchReplaceBtn->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
BView* searchView = new BView("searchreplace", B_WILL_DRAW);
// clang-format off
BLayoutBuilder::Group<>(searchView, B_VERTICAL, B_USE_DEFAULT_SPACING)
.SetInsets(B_USE_HALF_ITEM_INSETS, B_USE_ITEM_INSETS,
B_USE_HALF_ITEM_INSETS, B_USE_HALF_ITEM_INSETS)
.AddGrid(B_USE_HALF_ITEM_SPACING, B_USE_HALF_ITEM_SPACING)
.Add(fSearchInput->CreateLabelLayoutItem(), 0, 0, 1)
.Add(fSearchInput->CreateTextViewLayoutItem(), 1, 0, 1)
.Add(fReplaceInput->CreateLabelLayoutItem(), 0, 1, 1)
.Add(fReplaceInput->CreateTextViewLayoutItem(), 1, 1, 1)
.End()
.AddGroup(B_HORIZONTAL, B_USE_SMALL_SPACING)
.Add(fCaseCheck)
.Add(fWholeWordCheck)
.End()
.Add(searchReplaceBtn)
.End();
// clang-format on
searchReplaceBox->AddChild(searchView);
// === Line Breaks Options Box ===
BBox* breakBox = new BBox("LineBreakOptionsBox");
breakBox->SetLabel(B_TRANSLATE("Line break options"));
fBreakMenu = new BMenu("linebreaks");
fBreakMenu->AddItem(new BMenuItem(B_TRANSLATE("Remove all"), new BMessage(M_MODE_REMOVE_ALL)));
fBreakMenu->AddItem(new BMenuItem(B_TRANSLATE("Replace with" B_UTF8_ELLIPSIS),
new BMessage(M_MODE_REPLACE_LINE_BREAKS)));
fBreakMenu->AddItem(
new BMenuItem(B_TRANSLATE("Break on" B_UTF8_ELLIPSIS), new BMessage(M_MODE_BREAK_ON)));
fBreakMenu->AddItem(new BMenuItem(B_TRANSLATE("Break after X characters" B_UTF8_ELLIPSIS),
new BMessage(M_MODE_BREAK_AFTER_CHARS)));
fBreakMenu->SetLabelFromMarked(true);
fBreakMenu->SetRadioMode(true);
fBreakMenu->ItemAt(0L)->SetMarked(true);
BMenuField* breakField = new BMenuField("breakField", "", fBreakMenu);
fBreakInput = new BTextControl("MaxWidthInput", nullptr, "", nullptr);
fBreakInput->SetEnabled(false);
fBreakInput->SetExplicitMinSize(BSize(100, B_SIZE_UNSET));
fBreakOnChars
= new BSpinner("BreakOn", B_TRANSLATE_COMMENT("Chars:", "As short as possible"), nullptr);
fBreakOnChars->SetMinValue(1);
fBreakOnChars->SetEnabled(false);
fWordWrapCheck = new BCheckBox("SplitWords",
B_TRANSLATE_COMMENT("Split on words", "As short as possible"), NULL);
fWordWrapCheck->SetEnabled(false);
fKeepDelimiterCheck = new BCheckBox("KeepDelimiter",
B_TRANSLATE_COMMENT("Keep delimiter", "As short as possible"), NULL);
fKeepDelimiterCheck->SetEnabled(false);
BButton* applyBtn
= new BButton("ApplyBtn", B_TRANSLATE("Apply"), new BMessage(M_REMOVE_LINE_BREAKS));
applyBtn->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
BView* breakView = new BView("searchreplace", B_WILL_DRAW);
// clang-format off
BLayoutBuilder::Group<>(breakView, B_VERTICAL, B_USE_DEFAULT_SPACING)
.SetInsets(B_USE_HALF_ITEM_INSETS, B_USE_ITEM_INSETS,
B_USE_HALF_ITEM_INSETS, B_USE_HALF_ITEM_INSETS)
.Add(breakField)
.AddGroup(B_HORIZONTAL)
.Add(fBreakInput)
.Add(fBreakOnChars)
.End()
.AddGroup(B_HORIZONTAL)
.Add(fWordWrapCheck)
.Add(fKeepDelimiterCheck)
.End()
.Add(applyBtn)
.End();
// clang-format on
breakBox->AddChild(breakView);
// === Cleanup Box ===
BBox* cleanupBox = new BBox("CleanupBox");
cleanupBox->SetLabel(B_TRANSLATE("Cleanup"));
BButton* trimLinesBtn = new BButton("TrimLinesBtn",
B_TRANSLATE_COMMENT("Trim whitespace", "As short as possible"), new BMessage(M_TRIM_LINES));
trimLinesBtn->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
BButton* trimEmptyLinesBtn = new BButton("TrimEmptyLinesBtn",
B_TRANSLATE_COMMENT("Remove empty lines", "As short as possible"),
new BMessage(M_TRIM_EMPTY_LINES));
trimEmptyLinesBtn->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
BButton* removeDuplicates = new BButton("RemoveDuplicatesBtn",
B_TRANSLATE_COMMENT("Remove duplicate lines", "As short as possible"),
new BMessage(M_REMOVE_DUPLICATES));
removeDuplicates->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
BView* cleanView = new BView("cleanView", B_WILL_DRAW);
// clang-format off
BLayoutBuilder::Group<>(cleanView, B_VERTICAL, B_USE_HALF_ITEM_SPACING)
.SetInsets(B_USE_HALF_ITEM_INSETS, B_USE_ITEM_INSETS,
B_USE_HALF_ITEM_INSETS, B_USE_HALF_ITEM_INSETS)
.Add(trimLinesBtn)
.Add(trimEmptyLinesBtn)
.Add(removeDuplicates)
.End();
// clang-format on
cleanupBox->AddChild(cleanView);
// === Line Operations Tab ===
BView* lineOperationsView = new BView("lineView", B_WILL_DRAW);
BLayoutBuilder::Group<>(lineOperationsView, B_VERTICAL, B_USE_SMALL_SPACING)
.SetInsets(B_USE_ITEM_INSETS)
.Add(searchReplaceBox)
.Add(breakBox)
.Add(cleanupBox)
.AddGlue()
.End();
BTab* lineOperationsTab = new BTab();
AddTab(lineOperationsView, lineOperationsTab);
lineOperationsTab->SetLabel(B_TRANSLATE_COMMENT("Lines", "As short as possible"));
}
void
Sidebar::_BuildPrefixTab()
{
// === Prefix/Suffix Box ===
BBox* prefixSuffixBox = new BBox("PrefixSuffixBox");
prefixSuffixBox->SetLabel(B_TRANSLATE("Prefix/suffix each line"));
fPrefixInput = new BTextControl("PrefixInput",
B_TRANSLATE_COMMENT("Prefix:", "As short as possible"), "", nullptr);
fSuffixInput = new BTextControl("SuffixInput",
B_TRANSLATE_COMMENT("Suffix:", "As short as possible"), "", nullptr);
BButton* addBtn = new BButton("addPrefixSuffixBtn", B_TRANSLATE_COMMENT(
"Add", "As short as possible"), new BMessage(M_TRANSFORM_PREFIX_SUFFIX));
BButton* removeBtn = new BButton("removePrefixSuffixBtn", B_TRANSLATE_COMMENT(
"Remove", "As short as possible"), new BMessage(M_TRANSFORM_REMOVE_PREFIX_SUFFIX));
BView* presuffixView = new BView("prefixsuffix", B_WILL_DRAW);
// clang-format off
BLayoutBuilder::Group<>(presuffixView, B_VERTICAL, B_USE_DEFAULT_SPACING)
.SetInsets(B_USE_HALF_ITEM_INSETS, B_USE_ITEM_INSETS,
B_USE_HALF_ITEM_INSETS, B_USE_HALF_ITEM_INSETS)
.AddGrid(B_USE_HALF_ITEM_SPACING, B_USE_HALF_ITEM_SPACING)
.Add(fPrefixInput->CreateLabelLayoutItem(), 0, 0, 1)
.Add(fPrefixInput->CreateTextViewLayoutItem(), 1, 0, 1)
.Add(fSuffixInput->CreateLabelLayoutItem(), 0, 1, 1)
.Add(fSuffixInput->CreateTextViewLayoutItem(), 1, 1, 1)
.End()
.AddGroup(B_HORIZONTAL)
.Add(addBtn)
.AddGlue()
.Add(removeBtn)
.End();
// clang-format on
prefixSuffixBox->AddChild(presuffixView);
// === Indent/Unindent Box ===
BBox* indentBox = new BBox("IndentBox");
indentBox->SetLabel(B_TRANSLATE("Indent/unindent lines"));
// Spinner for indent size
fIndentSizeSpinner = new BSpinner("IndentSize", B_TRANSLATE("Indent size:"), nullptr);
fIndentSizeSpinner->SetValue(4);
fIndentSizeSpinner->SetRange(1, 16);
// Radio buttons for tab/space selection
fTabsRadio = new BRadioButton("TabsRadio", B_TRANSLATE("Tabs"), nullptr);
fSpacesRadio = new BRadioButton("SpacesRadio", B_TRANSLATE("Spaces"), nullptr);
fSpacesRadio->SetValue(B_CONTROL_ON);
// Buttons
BButton* indentButton = new BButton("IndentBtn",
B_TRANSLATE_COMMENT("Indent", "As short as possible"), new BMessage(M_INDENT_LINES));
BButton* unindentButton = new BButton("UnindentBtn",
B_TRANSLATE_COMMENT("Unindent", "As short as possible"), new BMessage(M_UNINDENT_LINES));
BView* indentView = new BView("indent", B_WILL_DRAW);
// clang-format off
BLayoutBuilder::Group<>(indentView, B_VERTICAL, B_USE_DEFAULT_SPACING)
.SetInsets(B_USE_HALF_ITEM_INSETS, B_USE_ITEM_INSETS,
B_USE_HALF_ITEM_INSETS, B_USE_HALF_ITEM_INSETS)
.Add(fIndentSizeSpinner)
.AddGroup(B_HORIZONTAL)
.Add(fTabsRadio)
.Add(fSpacesRadio)
.End()
.AddGroup(B_HORIZONTAL)
.Add(indentButton)
.AddGlue()
.Add(unindentButton)
.End();
// clang-format on
indentBox->AddChild(indentView);
// === Prefix/suffix Tab ===
BView* prefixSuffixView = new BView("presuffixView", B_WILL_DRAW);
BLayoutBuilder::Group<>(prefixSuffixView, B_VERTICAL, B_USE_SMALL_SPACING)
.SetInsets(B_USE_ITEM_INSETS)
.Add(prefixSuffixBox)
.Add(indentBox)
.AddGlue()
.End();
BTab* prefixSuffixTab = new BTab();
AddTab(prefixSuffixView, prefixSuffixTab);
prefixSuffixTab->SetLabel(B_TRANSLATE_COMMENT("Prefix/suffix", "As short as possible"));
}
void
Sidebar::_BuildSortTab()
{
// === Sort Box ===
BBox* sortBox = new BBox("SortBox");
sortBox->SetLabel(B_TRANSLATE("Sort lines"));
// --- Sorting method group ---
fAlphaSortRadio = new BRadioButton("radio_sort_alpha", B_TRANSLATE("Alphabetical"), nullptr);
fLengthSortRadio
= new BRadioButton("radio_sort_length", B_TRANSLATE("By line length"), nullptr);
BView* sortTypeGroup = new BView("sortTypeGroup", B_WILL_DRAW);
BLayoutBuilder::Group<>(sortTypeGroup, B_VERTICAL, 0)
.Add(fAlphaSortRadio)
.Add(fLengthSortRadio);
// --- Sort order group ---
fSortAsc = new BRadioButton("ascRadio", B_TRANSLATE("Ascending"), nullptr);
fSortDesc = new BRadioButton("descRadio", B_TRANSLATE("Descending"), nullptr);
fCaseSortCheck = new BCheckBox("caseSortCheck", B_TRANSLATE("Case sensitive"), nullptr);
BView* sortOrderGroup = new BView("sortOrderGroup", B_WILL_DRAW);
BLayoutBuilder::Group<>(sortOrderGroup, B_VERTICAL, 0)
.Add(fSortAsc)
.Add(fSortDesc)
.AddStrut(B_USE_HALF_ITEM_SPACING)
.Add(fCaseSortCheck);
BButton* sortButton = new BButton("sortBtn", B_TRANSLATE("Sort"), new BMessage(M_SORT_LINES));
sortButton->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
// Layout the full Sort Box
BView* sortView = new BView("sortView", B_WILL_DRAW);
// clang-format off
BLayoutBuilder::Group<>(sortView, B_VERTICAL)
.SetInsets(B_USE_HALF_ITEM_INSETS, B_USE_ITEM_INSETS,
B_USE_HALF_ITEM_INSETS, B_USE_HALF_ITEM_INSETS)
.Add(new BStringView(nullptr, B_TRANSLATE("Sort type:")))
.AddGroup(B_HORIZONTAL)
.AddStrut(B_USE_HALF_ITEM_SPACING)
.Add(sortTypeGroup)
.AddGlue()
.End()
.Add(new BStringView(nullptr, B_TRANSLATE("Sort order:")))
.AddGroup(B_HORIZONTAL)
.AddStrut(B_USE_HALF_ITEM_SPACING)
.Add(sortOrderGroup)
.AddGlue()
.End()
.Add(sortButton)
.End();
// clang-format on
sortBox->AddChild(sortView);
fAlphaSortRadio->SetValue(B_CONTROL_ON);
fSortAsc->SetValue(B_CONTROL_ON);
fCaseSortCheck->SetValue(B_CONTROL_OFF);
// === Sort Tab ===
BView* sortingView = new BView("sortview", B_WILL_DRAW);
// clang-format off
BLayoutBuilder::Group<>(sortingView, B_VERTICAL, B_USE_SMALL_SPACING)
.SetInsets(B_USE_ITEM_INSETS)
.Add(sortBox)
.AddGlue()
.End();
// clang-format on
BTab* sortTab = new BTab();
AddTab(sortingView, sortTab);
sortTab->SetLabel(B_TRANSLATE_COMMENT("Sort lines", "As short as possible"));
}
// Search and replace
BString
Sidebar::getSearchText() const
{
return fSearchInput->Text();
}
void
Sidebar::setSearchText(const BString& text)
{
fSearchInput->SetText(text);
}
BString
Sidebar::getReplaceText() const
{
return fReplaceInput->Text();
}
void
Sidebar::setReplaceText(const BString& text)
{
fReplaceInput->SetText(text);
}
bool
Sidebar::getReplaceCaseSensitive() const
{
return fCaseCheck->Value() == B_CONTROL_ON;
}
void
Sidebar::setReplaceCaseSensitive(bool enabled)
{
fCaseCheck->SetValue(enabled ? B_CONTROL_ON : B_CONTROL_OFF);
}
bool
Sidebar::getReplaceFullWords() const
{
return fWholeWordCheck->Value() == B_CONTROL_ON;
}
void
Sidebar::setReplaceFullWords(bool enabled)
{
fWholeWordCheck->SetValue(enabled ? B_CONTROL_ON : B_CONTROL_OFF);
}
// Line break mode
int8
Sidebar::getBreakMode() const
{
return fBreakMode;
}
void
Sidebar::setBreakMode(int breakMode)
{
fBreakMenu->ItemAt(breakMode)->SetMarked(true);
}
BString
Sidebar::getBreakModeInput()
{
return fBreakInput->Text();
}
void
Sidebar::setBreakModeInput(const BString& text)
{
fBreakInput->SetText(text);
}
int
Sidebar::getBreakOnCharsSpinner()
{
return fBreakOnChars->Value();
}
void
Sidebar::setBreakOnCharsSpinner(const int value)
{
fBreakOnChars->SetValue(value);
}
bool
Sidebar::getSplitOnWords() const
{
return fWordWrapCheck->Value() == B_CONTROL_ON;
}
void
Sidebar::setSplitOnWords(bool enabled)
{
fWordWrapCheck->SetValue(enabled ? B_CONTROL_ON : B_CONTROL_OFF);
}
bool
Sidebar::getKeepDelimiterValue()
{
return fKeepDelimiterCheck->Value() == B_CONTROL_ON;
}
void
Sidebar::setKeepDelimiterValue(const bool value)
{
fKeepDelimiterCheck->SetValue(value ? B_CONTROL_ON : B_CONTROL_OFF);
}
// Prefix/suffix
BString
Sidebar::getPrefixText() const
{
return fPrefixInput->Text();
}
void
Sidebar::setPrefixText(const BString& text)
{
fPrefixInput->SetText(text);
}
BString
Sidebar::getSuffixText() const
{
return fSuffixInput->Text();
}
void
Sidebar::setSuffixText(const BString& text)
{
fSuffixInput->SetText(text);
}
// Indent/unindent
int32
Sidebar::getIndentSpinner() const
{
return fIndentSizeSpinner->Value();
}
void
Sidebar::setIndentSpinner(const int value)
{
fIndentSizeSpinner->SetValue(value);
}
bool
Sidebar::getTabsRadio() const
{
return fTabsRadio->Value() == B_CONTROL_ON;
}
void
Sidebar::setTabsRadio(bool enabled) const
{
fTabsRadio->SetValue(enabled ? B_CONTROL_ON : B_CONTROL_OFF);
fSpacesRadio->SetValue(enabled ? B_CONTROL_OFF : B_CONTROL_ON);
}
// Sort lines
bool
Sidebar::getAlphaSortRadio() const
{
return fAlphaSortRadio && fAlphaSortRadio->Value() == B_CONTROL_ON;
}
void
Sidebar::setAlphaSortRadio(bool enabled) const
{
fAlphaSortRadio->SetValue(enabled ? B_CONTROL_ON : B_CONTROL_OFF);
fLengthSortRadio->SetValue(enabled ? B_CONTROL_OFF : B_CONTROL_ON);
}
bool
Sidebar::getSortAsc() const
{
return fSortAsc && fSortAsc->Value() == B_CONTROL_ON;
}
void
Sidebar::setSortAsc(bool enabled) const
{
fSortAsc->SetValue(enabled ? B_CONTROL_ON : B_CONTROL_OFF);
fSortDesc->SetValue(enabled ? B_CONTROL_OFF : B_CONTROL_ON);
}
bool
Sidebar::getCaseSortCheck() const
{
return fCaseSortCheck && fCaseSortCheck->Value() == B_CONTROL_ON;
}
void
Sidebar::setCaseSortCheck(bool enabled)
{
fCaseSortCheck->SetValue(enabled ? B_CONTROL_ON : B_CONTROL_OFF);
}