* added "NativeSaver" which combines the MessageExporter and AttributeSaver
to save the document also as icon attribute to a native Icon-O-Matic document file * added cmd-Y short cut to main window (on a German keyboard, Y and Z are swapped, but the Undo/Redo shortcuts are still "Z" while Z is much harder to reach than Y) * fixed warning in SetColorCommand.cpp * FlatIconExporter needs to save the attribute using B_VECTOR_ICON_TYPE (of course) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21235 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -35,6 +35,7 @@
|
|||||||
#include "MessageExporter.h"
|
#include "MessageExporter.h"
|
||||||
#include "MessageImporter.h"
|
#include "MessageImporter.h"
|
||||||
#include "MessengerSaver.h"
|
#include "MessengerSaver.h"
|
||||||
|
#include "NativeSaver.h"
|
||||||
#include "PathContainer.h"
|
#include "PathContainer.h"
|
||||||
#include "RDefExporter.h"
|
#include "RDefExporter.h"
|
||||||
#include "SavePanel.h"
|
#include "SavePanel.h"
|
||||||
@@ -354,7 +355,7 @@ IconEditorApp::_Open(const entry_ref& ref, bool append)
|
|||||||
switch (refMode) {
|
switch (refMode) {
|
||||||
case REF_MESSAGE:
|
case REF_MESSAGE:
|
||||||
fDocument->SetNativeSaver(
|
fDocument->SetNativeSaver(
|
||||||
new SimpleFileSaver(new MessageExporter(), ref));
|
new NativeSaver(ref));
|
||||||
break;
|
break;
|
||||||
case REF_FLAT:
|
case REF_FLAT:
|
||||||
fDocument->SetExportSaver(
|
fDocument->SetExportSaver(
|
||||||
@@ -475,7 +476,7 @@ IconEditorApp::_CreateSaver(const entry_ref& ref, uint32 exportMode)
|
|||||||
|
|
||||||
case EXPORT_MODE_MESSAGE:
|
case EXPORT_MODE_MESSAGE:
|
||||||
default:
|
default:
|
||||||
saver = new SimpleFileSaver(new MessageExporter(), ref);
|
saver = new NativeSaver(ref);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ Application Icon-O-Matic :
|
|||||||
DocumentSaver.cpp
|
DocumentSaver.cpp
|
||||||
FileSaver.cpp
|
FileSaver.cpp
|
||||||
MessengerSaver.cpp
|
MessengerSaver.cpp
|
||||||
|
NativeSaver.cpp
|
||||||
SimpleFileSaver.cpp
|
SimpleFileSaver.cpp
|
||||||
|
|
||||||
# generic/command
|
# generic/command
|
||||||
|
|||||||
@@ -480,6 +480,9 @@ MainWindow::_Init()
|
|||||||
fSwatchGroup->SetCurrentColor(CurrentColor::Default());
|
fSwatchGroup->SetCurrentColor(CurrentColor::Default());
|
||||||
|
|
||||||
SetIcon(fDocument->Icon());
|
SetIcon(fDocument->Icon());
|
||||||
|
|
||||||
|
AddShortcut('Y', 0, new BMessage(MSG_UNDO));
|
||||||
|
AddShortcut('Y', B_SHIFT_KEY, new BMessage(MSG_REDO));
|
||||||
}
|
}
|
||||||
|
|
||||||
// _CreateGUI
|
// _CreateGUI
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2007, Haiku. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Stephan Aßmus <[email protected]>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "NativeSaver.h"
|
||||||
|
|
||||||
|
#include "FlatIconFormat.h"
|
||||||
|
#include "MessageExporter.h"
|
||||||
|
|
||||||
|
// constructor
|
||||||
|
NativeSaver::NativeSaver(const entry_ref& ref)
|
||||||
|
: fAttrSaver(ref, kVectorAttrNodeName),
|
||||||
|
fFileSaver(new MessageExporter(), ref)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// destructor
|
||||||
|
NativeSaver::~NativeSaver()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save
|
||||||
|
status_t
|
||||||
|
NativeSaver::Save(Document* document)
|
||||||
|
{
|
||||||
|
status_t ret = fFileSaver.Save(document);
|
||||||
|
if (ret < B_OK)
|
||||||
|
return ret;
|
||||||
|
return fAttrSaver.Save(document);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2007, Haiku. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Stephan Aßmus <[email protected]>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef NATIVE_SAVER_H
|
||||||
|
#define NATIVE_SAVER_H
|
||||||
|
|
||||||
|
#include "AttributeSaver.h"
|
||||||
|
#include "SimpleFileSaver.h"
|
||||||
|
|
||||||
|
class NativeSaver : public DocumentSaver {
|
||||||
|
public:
|
||||||
|
NativeSaver(const entry_ref& ref);
|
||||||
|
virtual ~NativeSaver();
|
||||||
|
|
||||||
|
virtual status_t Save(Document* document);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
AttributeSaver fAttrSaver;
|
||||||
|
SimpleFileSaver fFileSaver;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NATIVE_SAVER_H
|
||||||
@@ -109,7 +109,7 @@ FlatIconExporter::Export(const Icon* icon, BNode* node,
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
// write buffer to attribute
|
// write buffer to attribute
|
||||||
ssize_t written = node->WriteAttr(attrName, B_RAW_TYPE, 0,
|
ssize_t written = node->WriteAttr(attrName, B_VECTOR_ICON_TYPE, 0,
|
||||||
buffer.Buffer(), buffer.SizeUsed());
|
buffer.Buffer(), buffer.SizeUsed());
|
||||||
if (written != (ssize_t)buffer.SizeUsed()) {
|
if (written != (ssize_t)buffer.SizeUsed()) {
|
||||||
if (written < 0)
|
if (written < 0)
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ SetColorCommand::InitCheck()
|
|||||||
#ifdef __HAIKU__
|
#ifdef __HAIKU__
|
||||||
return fStyle && fStyle->Color() != fColor ? B_OK : B_NO_INIT;
|
return fStyle && fStyle->Color() != fColor ? B_OK : B_NO_INIT;
|
||||||
#else
|
#else
|
||||||
return fStyle && *(uint32*)&fStyle->Color() != *(uint32*)&fColor ?
|
rgb_color color = fStyle->Color();
|
||||||
|
return fStyle && *(uint32*)&color != *(uint32*)&fColor ?
|
||||||
B_OK : B_NO_INIT;
|
B_OK : B_NO_INIT;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user