Implemented focusing the Name property on pressing Command-E. (Ticket #2742)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33631 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
df01744a4f
commit
b24366c6d8
@ -1,9 +1,6 @@
|
||||
/*
|
||||
* Copyright 2006-2008, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Stephan Aßmus <superstippi@gmx.de>
|
||||
* Copyright 2006-2009, Stephan Aßmus <superstippi@gmx.de>.
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#include "MainWindow.h"
|
||||
@ -80,6 +77,8 @@ enum {
|
||||
MSG_STYLE_RESET_TRANSFORMATION = 'rtst',
|
||||
|
||||
MSG_MOUSE_FILTER_MODE = 'mfmd',
|
||||
|
||||
MSG_RENAME_OBJECT = 'rnam',
|
||||
};
|
||||
|
||||
// constructor
|
||||
@ -358,6 +357,10 @@ case MSG_SHAPE_SELECTED: {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MSG_RENAME_OBJECT:
|
||||
fPropertyListView->FocusNameProperty();
|
||||
break;
|
||||
|
||||
default:
|
||||
BWindow::MessageReceived(message);
|
||||
}
|
||||
@ -576,6 +579,7 @@ MainWindow::_Init()
|
||||
|
||||
AddShortcut('Y', 0, new BMessage(MSG_UNDO));
|
||||
AddShortcut('Y', B_SHIFT_KEY, new BMessage(MSG_REDO));
|
||||
AddShortcut('E', 0, new BMessage(MSG_RENAME_OBJECT));
|
||||
}
|
||||
|
||||
// _CreateGUI
|
||||
@ -1027,9 +1031,9 @@ MainWindow::_CreateMenuBar(BRect frame)
|
||||
new BMessage(MSG_SAVE_AS), 'S', B_SHIFT_KEY));
|
||||
fileMenu->AddSeparatorItem();
|
||||
fileMenu->AddItem(new BMenuItem("Export",
|
||||
new BMessage(MSG_EXPORT), 'E'));
|
||||
new BMessage(MSG_EXPORT), 'P'));
|
||||
fileMenu->AddItem(new BMenuItem("Export As"B_UTF8_ELLIPSIS,
|
||||
new BMessage(MSG_EXPORT_AS), 'E', B_SHIFT_KEY));
|
||||
new BMessage(MSG_EXPORT_AS), 'P', B_SHIFT_KEY));
|
||||
fileMenu->AddSeparatorItem();
|
||||
fileMenu->AddItem(new BMenuItem("Quit",
|
||||
new BMessage(B_QUIT_REQUESTED), 'Q'));
|
||||
|
@ -80,13 +80,15 @@ class PropertyListView : public BView,
|
||||
void Clicked(PropertyItemView* item);
|
||||
void DoubleClicked(PropertyItemView* item);
|
||||
|
||||
private:
|
||||
protected:
|
||||
PropertyItemView* _ItemAt(int32 index) const;
|
||||
int32 _CountItems() const;
|
||||
|
||||
private:
|
||||
void _UpdateSavedProperties();
|
||||
|
||||
bool _AddItem(PropertyItemView* item);
|
||||
PropertyItemView* _RemoveItem(int32 index);
|
||||
PropertyItemView* _ItemAt(int32 index) const;
|
||||
int32 _CountItems() const;
|
||||
|
||||
void _MakeEmpty();
|
||||
|
||||
|
@ -13,8 +13,10 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "CommandStack.h"
|
||||
#include "CommonPropertyIDs.h"
|
||||
#include "IconObject.h"
|
||||
#include "Property.h"
|
||||
#include "PropertyItemView.h"
|
||||
#include "PropertyObject.h"
|
||||
#include "Selection.h"
|
||||
#include "SetPropertiesCommand.h"
|
||||
@ -161,6 +163,25 @@ IconObjectListView::SetCommandStack(CommandStack* stack)
|
||||
fCommandStack = stack;
|
||||
}
|
||||
|
||||
// FocusNameProperty
|
||||
void
|
||||
IconObjectListView::FocusNameProperty()
|
||||
{
|
||||
if (fObject == NULL)
|
||||
return;
|
||||
|
||||
int32 count = _CountItems();
|
||||
for (int32 i = 0; i < count; i++) {
|
||||
PropertyItemView* item = _ItemAt(i);
|
||||
Property* property = item->GetProperty();
|
||||
if (property != NULL && property->Identifier() == PROPERTY_NAME) {
|
||||
item->MakeFocus(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
// _SetObject
|
||||
|
@ -38,6 +38,8 @@ class IconObjectListView : public PropertyListView,
|
||||
void SetSelection(Selection* selection);
|
||||
void SetCommandStack(CommandStack* stack);
|
||||
|
||||
void FocusNameProperty();
|
||||
|
||||
private:
|
||||
void _SetObject(IconObject* object);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user