Terminal: Make cursor blinking an option.
Signed-off-by: Rene Gollent <[email protected]>
This commit is contained in:
committed by
Rene Gollent
parent
dd15872ac9
commit
4e3d346e91
@@ -80,6 +80,10 @@ AppearancePrefView::AppearancePrefView(const char* name,
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
fBlinkCursor = new BCheckBox(
|
||||||
|
B_TRANSLATE("Blink the cursor"),
|
||||||
|
new BMessage(MSG_BLINK_CURSOR_CHANGED));
|
||||||
|
|
||||||
fWarnOnExit = new BCheckBox(
|
fWarnOnExit = new BCheckBox(
|
||||||
B_TRANSLATE("Confirm exit if active programs exist"),
|
B_TRANSLATE("Confirm exit if active programs exist"),
|
||||||
new BMessage(MSG_WARN_ON_EXIT_CHANGED));
|
new BMessage(MSG_WARN_ON_EXIT_CHANGED));
|
||||||
@@ -141,6 +145,7 @@ AppearancePrefView::AppearancePrefView(const char* name,
|
|||||||
.AddGlue()
|
.AddGlue()
|
||||||
.Add(fColorControl = new BColorControl(BPoint(10, 10),
|
.Add(fColorControl = new BColorControl(BPoint(10, 10),
|
||||||
B_CELLS_32x8, 8.0, "", new BMessage(MSG_COLOR_CHANGED)))
|
B_CELLS_32x8, 8.0, "", new BMessage(MSG_COLOR_CHANGED)))
|
||||||
|
.Add(fBlinkCursor)
|
||||||
.Add(fWarnOnExit);
|
.Add(fWarnOnExit);
|
||||||
|
|
||||||
fTabTitle->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
|
fTabTitle->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
|
||||||
@@ -157,6 +162,7 @@ AppearancePrefView::AppearancePrefView(const char* name,
|
|||||||
fColorControl->SetValue(
|
fColorControl->SetValue(
|
||||||
PrefHandler::Default()->getRGB(PREF_TEXT_FORE_COLOR));
|
PrefHandler::Default()->getRGB(PREF_TEXT_FORE_COLOR));
|
||||||
|
|
||||||
|
fBlinkCursor->SetValue(PrefHandler::Default()->getBool(PREF_BLINK_CURSOR));
|
||||||
fWarnOnExit->SetValue(PrefHandler::Default()->getBool(PREF_WARN_ON_EXIT));
|
fWarnOnExit->SetValue(PrefHandler::Default()->getBool(PREF_WARN_ON_EXIT));
|
||||||
|
|
||||||
BTextControl* redInput = (BTextControl*)fColorControl->ChildAt(0);
|
BTextControl* redInput = (BTextControl*)fColorControl->ChildAt(0);
|
||||||
@@ -205,6 +211,7 @@ AppearancePrefView::AttachedToWindow()
|
|||||||
{
|
{
|
||||||
fTabTitle->SetTarget(this);
|
fTabTitle->SetTarget(this);
|
||||||
fWindowTitle->SetTarget(this);
|
fWindowTitle->SetTarget(this);
|
||||||
|
fBlinkCursor->SetTarget(this);
|
||||||
fWarnOnExit->SetTarget(this);
|
fWarnOnExit->SetTarget(this);
|
||||||
|
|
||||||
fFontSize->Menu()->SetTargetForItems(this);
|
fFontSize->Menu()->SetTargetForItems(this);
|
||||||
@@ -293,6 +300,15 @@ AppearancePrefView::MessageReceived(BMessage* msg)
|
|||||||
fColorField->Menu()->FindMarked()->Label()));
|
fColorField->Menu()->FindMarked()->Label()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MSG_BLINK_CURSOR_CHANGED:
|
||||||
|
if (PrefHandler::Default()->getBool(PREF_BLINK_CURSOR)
|
||||||
|
!= fBlinkCursor->Value()) {
|
||||||
|
PrefHandler::Default()->setBool(PREF_BLINK_CURSOR,
|
||||||
|
fBlinkCursor->Value());
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case MSG_WARN_ON_EXIT_CHANGED:
|
case MSG_WARN_ON_EXIT_CHANGED:
|
||||||
if (PrefHandler::Default()->getBool(PREF_WARN_ON_EXIT)
|
if (PrefHandler::Default()->getBool(PREF_WARN_ON_EXIT)
|
||||||
!= fWarnOnExit->Value()) {
|
!= fWarnOnExit->Value()) {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ static const uint32 MSG_COLOR_SCHEMA_CHANGED = 'mccs';
|
|||||||
|
|
||||||
static const uint32 MSG_TAB_TITLE_SETTING_CHANGED = 'mtts';
|
static const uint32 MSG_TAB_TITLE_SETTING_CHANGED = 'mtts';
|
||||||
static const uint32 MSG_WINDOW_TITLE_SETTING_CHANGED = 'mwts';
|
static const uint32 MSG_WINDOW_TITLE_SETTING_CHANGED = 'mwts';
|
||||||
|
static const uint32 MSG_BLINK_CURSOR_CHANGED = 'mbcc';
|
||||||
static const uint32 MSG_WARN_ON_EXIT_CHANGED = 'mwec';
|
static const uint32 MSG_WARN_ON_EXIT_CHANGED = 'mwec';
|
||||||
static const uint32 MSG_COLS_CHANGED = 'mccl';
|
static const uint32 MSG_COLS_CHANGED = 'mccl';
|
||||||
static const uint32 MSG_ROWS_CHANGED = 'mcrw';
|
static const uint32 MSG_ROWS_CHANGED = 'mcrw';
|
||||||
@@ -71,6 +72,7 @@ private:
|
|||||||
const color_schema** schemas,
|
const color_schema** schemas,
|
||||||
const color_schema* defaultItemName);
|
const color_schema* defaultItemName);
|
||||||
|
|
||||||
|
BCheckBox* fBlinkCursor;
|
||||||
BCheckBox* fWarnOnExit;
|
BCheckBox* fWarnOnExit;
|
||||||
BMenuField* fFont;
|
BMenuField* fFont;
|
||||||
BMenuField* fFontSize;
|
BMenuField* fFontSize;
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ static const pref_defaults kTermDefaults[] = {
|
|||||||
|
|
||||||
{ PREF_TAB_TITLE, "%1d: %p" },
|
{ PREF_TAB_TITLE, "%1d: %p" },
|
||||||
{ PREF_WINDOW_TITLE, "Terminal %i: %t" },
|
{ PREF_WINDOW_TITLE, "Terminal %i: %t" },
|
||||||
|
{ PREF_BLINK_CURSOR, PREF_TRUE },
|
||||||
{ PREF_WARN_ON_EXIT, PREF_TRUE },
|
{ PREF_WARN_ON_EXIT, PREF_TRUE },
|
||||||
|
|
||||||
{ NULL, NULL},
|
{ NULL, NULL},
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ static const char* const PREF_SHELL = "Shell";
|
|||||||
static const char* const PREF_TEXT_ENCODING = "Text encoding";
|
static const char* const PREF_TEXT_ENCODING = "Text encoding";
|
||||||
static const char* const PREF_GUI_LANGUAGE = "Language";
|
static const char* const PREF_GUI_LANGUAGE = "Language";
|
||||||
|
|
||||||
|
static const char* const PREF_BLINK_CURSOR = "Blink the cursor";
|
||||||
static const char* const PREF_WARN_ON_EXIT = "Warn on exit";
|
static const char* const PREF_WARN_ON_EXIT = "Warn on exit";
|
||||||
|
|
||||||
static const char* const PREF_TAB_TITLE = "Tab title";
|
static const char* const PREF_TAB_TITLE = "Tab title";
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
#include "InlineInput.h"
|
#include "InlineInput.h"
|
||||||
|
#include "PrefHandler.h"
|
||||||
#include "Shell.h"
|
#include "Shell.h"
|
||||||
#include "ShellParameters.h"
|
#include "ShellParameters.h"
|
||||||
#include "TermConst.h"
|
#include "TermConst.h"
|
||||||
@@ -1096,9 +1097,11 @@ TermView::_DetachShell()
|
|||||||
void
|
void
|
||||||
TermView::_Activate()
|
TermView::_Activate()
|
||||||
{
|
{
|
||||||
|
bool blinkCursor = PrefHandler::Default()->getBool(PREF_BLINK_CURSOR);
|
||||||
|
|
||||||
fActive = true;
|
fActive = true;
|
||||||
|
|
||||||
if (fCursorBlinkRunner == NULL) {
|
if (fCursorBlinkRunner == NULL && blinkCursor) {
|
||||||
BMessage blinkMessage(kBlinkCursor);
|
BMessage blinkMessage(kBlinkCursor);
|
||||||
fCursorBlinkRunner = new (std::nothrow) BMessageRunner(
|
fCursorBlinkRunner = new (std::nothrow) BMessageRunner(
|
||||||
BMessenger(this), &blinkMessage, kCursorBlinkInterval);
|
BMessenger(this), &blinkMessage, kCursorBlinkInterval);
|
||||||
|
|||||||
Reference in New Issue
Block a user