Clean-up
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34059 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
51e49965a7
commit
fa1ee6d4d1
|
@ -21,5 +21,5 @@ Preference Shortcuts :
|
|||
ScrollViewCorner.cpp
|
||||
|
||||
: be tracker libshortcuts_shared.a $(TARGET_LIBSTDC++)
|
||||
: Shortcuts.rsrc
|
||||
: Shortcuts.rdef
|
||||
;
|
||||
|
|
|
@ -89,3 +89,4 @@ MetaKeyStateMap::GetName() const
|
|||
{
|
||||
return fKeyName;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,16 +5,17 @@
|
|||
* Authors:
|
||||
* Jeremy Friesner
|
||||
*/
|
||||
|
||||
|
||||
#ifndef MetaKeyStateMap_h
|
||||
#define MetaKeyStateMap_h
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#include <List.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
class BitFieldTester;
|
||||
|
||||
|
||||
// This class defines a set of possible chording states (e.g. "Left only",
|
||||
// "Right only", "Both", "Either") for a meta-key (e.g. Shift), and the
|
||||
// description strings and qualifier bit-chords that go with them.
|
||||
|
@ -35,7 +36,8 @@ public:
|
|||
void SetInfo(const char* keyName);
|
||||
|
||||
// (tester) becomes property of this map!
|
||||
void AddState(const char* desc, const BitFieldTester* tester);
|
||||
void AddState(const char* desc,
|
||||
const BitFieldTester* tester);
|
||||
|
||||
// Returns the name of the meta-key (e.g. "Ctrl")
|
||||
const char* GetName() const;
|
||||
|
@ -58,9 +60,10 @@ private:
|
|||
// list of strings e.g. "Left" or "Both"
|
||||
BList fStateDescs;
|
||||
|
||||
// list of BitFieldTesters for testing bits of modifiers
|
||||
// in state
|
||||
// list of BitFieldTesters for testing bits of modifiers in state
|
||||
BList fStateTesters;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -9,10 +9,11 @@
|
|||
|
||||
#include "ResizableButton.h"
|
||||
|
||||
|
||||
ResizableButton::ResizableButton(BRect parentFrame, BRect frame,
|
||||
const char* name, const char* label, BMessage* msg)
|
||||
const char* name, const char* label, BMessage* message)
|
||||
:
|
||||
BButton(frame, name, label, msg, B_FOLLOW_BOTTOM)
|
||||
BButton(frame, name, label, message, B_FOLLOW_BOTTOM)
|
||||
{
|
||||
float width = parentFrame.right - parentFrame.left;
|
||||
float height = parentFrame.bottom - parentFrame.top;
|
||||
|
@ -33,3 +34,4 @@ ResizableButton::ChangeToNewSize(float newWidth, float newHeight)
|
|||
ResizeTo(newW, b.bottom - b.top);
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
|
|
|
@ -5,26 +5,24 @@
|
|||
* Authors:
|
||||
* Jeremy Friesner
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ResizableButton_h
|
||||
#define ResizableButton_h
|
||||
|
||||
#include <Message.h>
|
||||
#include <Rect.h>
|
||||
#include <View.h>
|
||||
|
||||
#include <Button.h>
|
||||
|
||||
//Just like a regular BButton, but with a handy resize method added
|
||||
|
||||
class ResizableButton : public BButton {
|
||||
public:
|
||||
ResizableButton(BRect parentFrame, BRect frame,
|
||||
const char* name, const char* label,
|
||||
BMessage* msg);
|
||||
BMessage* message);
|
||||
|
||||
virtual void ChangeToNewSize(float newWidth, float newHeight);
|
||||
private:
|
||||
BRect fPercentages;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
|
||||
resource app_signature "application/x-vnd.Haiku-Shortcuts";
|
||||
|
||||
resource app_flags B_SINGLE_LAUNCH;
|
||||
|
||||
resource app_version {
|
||||
major = 1,
|
||||
middle = 0,
|
||||
minor = 0,
|
||||
|
||||
/* 0 = development 1 = alpha 2 = beta
|
||||
3 = gamma 4 = golden master 5 = final */
|
||||
variety = 2,
|
||||
internal = 0,
|
||||
|
||||
short_info = "Shortcuts",
|
||||
long_info = "Shortcuts ©1999-2009 Jeremy Friesner ©2009 Haiku Inc."
|
||||
};
|
||||
|
Binary file not shown.
|
@ -7,15 +7,16 @@
|
|||
* Fredrik Modéen
|
||||
*/
|
||||
|
||||
|
||||
#include "ShortcutsApp.h"
|
||||
|
||||
|
||||
#include "Alert.h"
|
||||
|
||||
#include <Alert.h>
|
||||
|
||||
#include "ShortcutsWindow.h"
|
||||
|
||||
#define APPLICATION_SIGNATURE "application/x-vnd.ShortcutsKeys"
|
||||
|
||||
#define APPLICATION_SIGNATURE "application/x-vnd.Haiku-Shortcuts"
|
||||
|
||||
|
||||
ShortcutsApp::ShortcutsApp()
|
||||
:
|
||||
|
@ -34,7 +35,6 @@ ShortcutsApp::ReadyToRun()
|
|||
|
||||
ShortcutsApp::~ShortcutsApp()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,7 +42,8 @@ void
|
|||
ShortcutsApp::AboutRequested()
|
||||
{
|
||||
BAlert* alert = new BAlert("About Shortcuts",
|
||||
"Shortcuts v1.28(SpicyKeys v1.28)\nby Jeremy Friesner"
|
||||
, "Ok");
|
||||
"Shortcuts\n\n"
|
||||
"Based on SpicyKeys for BeOS made by Jeremy Friesner.", "Ok");
|
||||
alert->Go();
|
||||
}
|
||||
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
* Jeremy Friesner
|
||||
* Fredrik Modéen
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ShortcutsApp_h
|
||||
#define ShortcutsApp_h
|
||||
|
||||
|
||||
#include <Application.h>
|
||||
|
||||
|
||||
class ShortcutsApp : public BApplication {
|
||||
public:
|
||||
ShortcutsApp();
|
||||
|
@ -21,4 +21,6 @@ public:
|
|||
virtual void AboutRequested();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -9,29 +9,28 @@
|
|||
|
||||
#include "ShortcutsSpec.h"
|
||||
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <Beep.h>
|
||||
#include <Directory.h>
|
||||
#include <NodeInfo.h>
|
||||
#include <Path.h>
|
||||
#include <Region.h>
|
||||
#include <Window.h>
|
||||
#include <Directory.h>
|
||||
#include <Path.h>
|
||||
#include <NodeInfo.h>
|
||||
#include <Beep.h>
|
||||
|
||||
|
||||
#include "ColumnListView.h"
|
||||
|
||||
|
||||
#include "Colors.h"
|
||||
#include "MetaKeyStateMap.h"
|
||||
#include "BitFieldTesters.h"
|
||||
#include "Colors.h"
|
||||
#include "CommandActuators.h"
|
||||
#include "MetaKeyStateMap.h"
|
||||
#include "ParseCommandLine.h"
|
||||
|
||||
|
||||
#define CLASS "ShortcutsSpec : "
|
||||
|
||||
|
||||
const float _height = 20.0f;
|
||||
|
||||
static MetaKeyStateMap _metaMaps[ShortcutsSpec::NUM_META_COLUMNS];
|
||||
|
@ -42,6 +41,7 @@ static BFont _viewFont;
|
|||
static float _fontHeight;
|
||||
static BBitmap * _actuatorBitmaps[2];
|
||||
|
||||
|
||||
// These meta-keys are pretty standard
|
||||
#define SHIFT_NAME "Shift"
|
||||
#define CONTROL_NAME "Control"
|
||||
|
@ -58,10 +58,12 @@ static BBitmap * _actuatorBitmaps[2];
|
|||
#define ICON_BITMAP_RECT BRect(0.0f, 0.0f, 15.0f, 15.0f)
|
||||
#define ICON_BITMAP_SPACE B_COLOR_8_BIT
|
||||
|
||||
|
||||
// Returns the (pos)'th char in the string, or '\0' if (pos) if off the end of
|
||||
// the string
|
||||
static char GetLetterAt(const char* str, int pos);
|
||||
|
||||
|
||||
static char
|
||||
GetLetterAt(const char* str, int pos)
|
||||
{
|
||||
|
@ -281,16 +283,16 @@ static bool IsValidActuatorName(const char* c);
|
|||
static bool
|
||||
IsValidActuatorName(const char* c)
|
||||
{
|
||||
return ((strcmp(c, "InsertString") == 0) ||
|
||||
(strcmp(c, "MoveMouse") == 0) ||
|
||||
(strcmp(c, "MoveMouseTo") == 0) ||
|
||||
(strcmp(c, "MouseButton") == 0) ||
|
||||
(strcmp(c, "LaunchHandler") == 0) || // new for v1.21 --jaf
|
||||
(strcmp(c, "Multi") == 0) || // new for v1.24 --jaf
|
||||
(strcmp(c, "MouseDown") == 0) || // new for v1.24 --jaf
|
||||
(strcmp(c, "MouseUp") == 0) || // new for v1.24 --jaf
|
||||
(strcmp(c, "SendMessage") == 0) || // new for v1.25 --jaf
|
||||
(strcmp(c, "Beep") == 0));
|
||||
return (strcmp(c, "InsertString") == 0
|
||||
|| strcmp(c, "MoveMouse") == 0
|
||||
|| strcmp(c, "MoveMouseTo") == 0
|
||||
|| strcmp(c, "MouseButton") == 0
|
||||
|| strcmp(c, "LaunchHandler") == 0
|
||||
|| strcmp(c, "Multi") == 0
|
||||
|| strcmp(c, "MouseDown") == 0
|
||||
|| strcmp(c, "MouseUp") == 0
|
||||
|| strcmp(c, "SendMessage") == 0
|
||||
|| strcmp(c, "Beep") == 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -300,7 +302,7 @@ ShortcutsSpec::Instantiate(BMessage* from)
|
|||
bool validateOK = false;
|
||||
if (validate_instantiation(from, "ShortcutsSpec"))
|
||||
validateOK = true;
|
||||
else //test the old one.
|
||||
else // test the old one.
|
||||
if (validate_instantiation(from, "SpicyKeysSpec"))
|
||||
validateOK = true;
|
||||
|
||||
|
@ -362,7 +364,8 @@ ShortcutsSpec::DrawItemColumn(BView* owner, BRect item_column_rect,
|
|||
point.Set(item_column_rect.left + STRING_COLUMN_LEFT_MARGIN,
|
||||
item_column_rect.top + fTextOffset);
|
||||
|
||||
item_column_rect.left = point.x;//keep text from drawing into icon area
|
||||
item_column_rect.left = point.x;
|
||||
// keep text from drawing into icon area
|
||||
|
||||
// scroll if too wide
|
||||
float rectWidth = item_column_rect.Width() - STRING_COLUMN_LEFT_MARGIN;
|
||||
|
@ -668,7 +671,7 @@ ShortcutsSpec::ProcessColumnKeyStroke(int whichColumn, const char* bytes,
|
|||
case B_BACKSPACE:
|
||||
case B_DELETE:
|
||||
if (fCommandNul > 0) {
|
||||
//trim a char off the string
|
||||
// trim a char off the string
|
||||
fCommand[fCommandNul - 1] = '\0';
|
||||
fCommandNul--; // note new nul position
|
||||
ret = true;
|
||||
|
@ -745,7 +748,8 @@ ShortcutsSpec::ProcessColumnKeyStroke(int whichColumn, const char* bytes,
|
|||
letter = toupper(letter); // convert to upper case
|
||||
|
||||
if ((letter == B_BACKSPACE) || (letter == B_DELETE))
|
||||
letter = '(';//so space bar will blank out an entry
|
||||
letter = '(';
|
||||
// so space bar will blank out an entry
|
||||
|
||||
for (int i = 0; i < numStates; i++) {
|
||||
const char* desc = map->GetNthStateDesc(i);
|
||||
|
@ -774,8 +778,8 @@ ShortcutsSpec::ProcessColumnKeyStroke(int whichColumn, const char* bytes,
|
|||
|
||||
|
||||
int
|
||||
ShortcutsSpec::MyCompare(const CLVListItem* a_Item1, const CLVListItem* a_Item2
|
||||
, int32 KeyColumn)
|
||||
ShortcutsSpec::MyCompare(const CLVListItem* a_Item1, const CLVListItem* a_Item2,
|
||||
int32 KeyColumn)
|
||||
{
|
||||
ShortcutsSpec* left = (ShortcutsSpec*) a_Item1;
|
||||
ShortcutsSpec* right = (ShortcutsSpec*) a_Item2;
|
||||
|
@ -836,3 +840,4 @@ ShortcutsSpec::_UpdateIconBitmap()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,23 +5,24 @@
|
|||
* Authors:
|
||||
* Jeremy Friesner
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ShortcutsSpec_h
|
||||
#define ShortcutsSpec_h
|
||||
|
||||
#include <Bitmap.h>
|
||||
|
||||
#include <Bitmap.h>
|
||||
|
||||
#include "CLVListItem.h"
|
||||
#include "KeyInfos.h"
|
||||
|
||||
|
||||
class CommandActuator;
|
||||
class MetaKeyStateMap;
|
||||
|
||||
|
||||
MetaKeyStateMap & GetNthKeyMap(int which);
|
||||
void InitializeMetaMaps();
|
||||
|
||||
|
||||
/* Objects of this class represent one hotkey "entry" in the preferences
|
||||
* ListView. Each ShortcutsSpec contains the info necessary to generate both
|
||||
* the proper GUI display, and the proper BitFieldTester and CommandActuator
|
||||
|
@ -41,7 +42,9 @@ public:
|
|||
const char* GetCellText(int whichColumn) const;
|
||||
void SetCommand(const char* commandStr);
|
||||
|
||||
virtual void DrawItemColumn(BView* owner, BRect item_column_rect, int32 column_index, bool columnSelected, bool complete);
|
||||
virtual void DrawItemColumn(BView* owner, BRect item_column_rect,
|
||||
int32 column_index, bool columnSelected,
|
||||
bool complete);
|
||||
|
||||
static int MyCompare(const CLVListItem* a_Item1,
|
||||
const CLVListItem* a_Item2, int32 KeyColumn);
|
||||
|
@ -102,3 +105,4 @@ private:
|
|||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -10,35 +10,33 @@
|
|||
|
||||
#include "ShortcutsWindow.h"
|
||||
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#include <Alert.h>
|
||||
#include <Application.h>
|
||||
#include <Clipboard.h>
|
||||
#include <MessageFilter.h>
|
||||
#include <File.h>
|
||||
#include <FindDirectory.h>
|
||||
#include <Input.h>
|
||||
#include <Menu.h>
|
||||
#include <MenuItem.h>
|
||||
#include <MenuBar.h>
|
||||
#include <MenuItem.h>
|
||||
#include <MessageFilter.h>
|
||||
#include <Path.h>
|
||||
#include <PopUpMenu.h>
|
||||
#include <ScrollBar.h>
|
||||
#include <ScrollView.h>
|
||||
#include <String.h>
|
||||
#include <Input.h>
|
||||
#include <PopUpMenu.h>
|
||||
#include <File.h>
|
||||
#include <Path.h>
|
||||
#include <FindDirectory.h>
|
||||
|
||||
#include "ColumnListView.h"
|
||||
|
||||
|
||||
#include "KeyInfos.h"
|
||||
#include "ShortcutsSpec.h"
|
||||
#include "ParseCommandLine.h"
|
||||
#include "MetaKeyStateMap.h"
|
||||
#include "ParseCommandLine.h"
|
||||
#include "ShortcutsFilterConstants.h"
|
||||
#include "ShortcutsSpec.h"
|
||||
|
||||
|
||||
// Window sizing constraints
|
||||
#define MIN_WIDTH 600
|
||||
|
@ -72,6 +70,7 @@ static BPopUpMenu* CreateMetaPopUp(int col)
|
|||
return popup;
|
||||
}
|
||||
|
||||
|
||||
// Creates a pop-up that allows the user to choose a key-cap visually
|
||||
static BPopUpMenu* CreateKeysPopUp();
|
||||
static BPopUpMenu* CreateKeysPopUp()
|
||||
|
@ -113,7 +112,8 @@ ShortcutsWindow::ShortcutsWindow()
|
|||
fileMenu->AddItem(new BMenuItem("Save KeySet As...",
|
||||
new BMessage(SAVE_KEYSET_AS), 'S'));
|
||||
fileMenu->AddItem(new BSeparatorItem);
|
||||
fileMenu->AddItem(new BMenuItem("About Shortcuts", new BMessage(B_ABOUT_REQUESTED)));
|
||||
fileMenu->AddItem(new BMenuItem("About Shortcuts",
|
||||
new BMessage(B_ABOUT_REQUESTED)));
|
||||
fileMenu->AddItem(new BSeparatorItem);
|
||||
fileMenu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED),
|
||||
'Q'));
|
||||
|
@ -257,7 +257,7 @@ ShortcutsWindow::QuitRequested()
|
|||
}
|
||||
|
||||
if (ret)
|
||||
fColumnListView->DeselectAll(); // avoid mysterious crash on PPC!?
|
||||
fColumnListView->DeselectAll();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -720,3 +720,4 @@ ShortcutsWindow::DispatchMessage(BMessage* msg, BHandler* handler)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,26 +5,23 @@
|
|||
* Authors:
|
||||
* Jeremy Friesner
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ShortcutsWindow_h
|
||||
#define ShortcutsWindow_h
|
||||
|
||||
#include <Message.h>
|
||||
#include <Window.h>
|
||||
#include <Point.h>
|
||||
|
||||
#include <Entry.h>
|
||||
#include <FilePanel.h>
|
||||
|
||||
#include <Message.h>
|
||||
#include <Point.h>
|
||||
#include <Window.h>
|
||||
|
||||
#include "ColumnListView.h"
|
||||
#include "ResizableButton.h"
|
||||
|
||||
|
||||
// This class defines our preferences/configuration window.
|
||||
class ShortcutsWindow : public BWindow {
|
||||
public:
|
||||
// If (optSaveTo) is non-NULL, settings will be loaded from the file it
|
||||
// represents.
|
||||
ShortcutsWindow();
|
||||
~ShortcutsWindow();
|
||||
|
||||
|
@ -81,4 +78,6 @@ private:
|
|||
bool fLastOpenWasAppend;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -7,12 +7,14 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "ShortcutsApp.h"
|
||||
#include "KeyInfos.h"
|
||||
#include "ShortcutsApp.h"
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
InitKeyIndices();
|
||||
(new ShortcutsApp)->Run();
|
||||
delete be_app;
|
||||
ShortcutsApp app;
|
||||
app.Run();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue