Icon-O-Matic: Remove dead homebrew translation system

Icon-O-Matic uses Locale.h now.

Change-Id: I9722ee76fda47821bf27e6195f8f6ec3d3e1b43e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6700
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Zardshard
2023-07-11 18:27:10 +00:00
committed by waddlesplash
parent 1d9ad3fad7
commit a75a222b35
22 changed files with 44 additions and 181 deletions
@@ -78,14 +78,3 @@ Command::CombineWithPrevious(const Command* previous)
{
return false;
}
// _GetString
const char*
Command::_GetString(uint32 key, const char* defaultString) const
{
// if (LanguageManager* manager = LanguageManager::Default())
// return manager->GetString(key, defaultString);
// else
return defaultString;
}
@@ -32,9 +32,6 @@ class Command {
virtual bool CombineWithPrevious(const Command* previous);
protected:
const char* _GetString(uint32 key,
const char* defaultString) const;
bigtime_t fTimeStamp;
};
@@ -92,5 +92,5 @@ CompoundCommand::Redo()
void
CompoundCommand::GetName(BString& name)
{
name << _GetString(fNameIndex, fName.String());
name << fName.String();
}
@@ -34,9 +34,7 @@ NudgePointsCommand::NudgePointsCommand(VectorPath* path,
1.0,
1.0,
count > 1 ? B_TRANSLATE("Nudge Control Points") :
B_TRANSLATE("Nudge Control Point"),
// count > 1 ? NUDGE_CONTROL_POINTS : NUDGE_CONTROL_POINT),
-1),
B_TRANSLATE("Nudge Control Point")),
fPath(path),
fIndices(NULL),
fPoints(NULL),
@@ -31,15 +31,13 @@ TransformPointsCommand::TransformPointsCommand(
double xScale,
double yScale,
const char* name,
int32 nameIndex)
const char* name)
: TransformCommand(pivot,
translation,
rotation,
xScale,
yScale,
name,
nameIndex),
name),
fTransformBox(box),
fPath(path),
fIndices(indices && count > 0 ?
@@ -40,8 +40,7 @@ class TransformPointsCommand : public TransformCommand,
double xScale,
double yScale,
const char* name,
int32 nameIndex);
const char* name);
virtual ~TransformPointsCommand();
// Command interface
@@ -160,8 +160,7 @@ TransformBox::MouseDown(BPoint where)
fCurrentState->SetOrigin(where);
delete fCurrentCommand;
fCurrentCommand = MakeCommand(fCurrentState->ActionName(),
fCurrentState->ActionNameIndex());
fCurrentCommand = MakeCommand(fCurrentState->ActionName());
}
return true;
@@ -302,7 +301,7 @@ TransformBox::HandleKeyDown(uint32 key, uint32 modifiers, Command** _command)
return false;
if (!fCurrentCommand) {
fCurrentCommand = MakeCommand("Translate", -1);
fCurrentCommand = MakeCommand("Translate");
}
TranslateBy(translation);
@@ -431,7 +430,7 @@ void
TransformBox::NudgeBy(BPoint offset)
{
if (!fNudging && !fCurrentCommand) {
fCurrentCommand = MakeCommand("Move", 0/*MOVE*/);
fCurrentCommand = MakeCommand("Move");
fNudging = true;
}
if (fNudging) {
@@ -80,8 +80,7 @@ class TransformBox : public ChannelTransform,
virtual float ZoomLevel() const;
virtual TransformCommand* MakeCommand(const char* actionName,
uint32 nameIndex) = 0;
virtual TransformCommand* MakeCommand(const char* actionName) = 0;
bool IsRotating() const
{ return fCurrentState == fRotateState; }
@@ -1,9 +1,10 @@
/*
* Copyright 2006-2009, Haiku.
* Copyright 2006-2009, 2023, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
* Stephan Aßmus <[email protected]>
* Zardshard
*/
#include "TransformBoxStates.h"
@@ -27,7 +28,6 @@
#define B_TRANSLATION_CONTEXT "Icon-O-Matic-TransformationBoxStates"
// constructor
DragState::DragState(TransformBox* parent)
:
fOrigin(0.0, 0.0),
@@ -36,7 +36,6 @@ DragState::DragState(TransformBox* parent)
}
// SetOrigin
void
DragState::SetOrigin(BPoint origin)
{
@@ -44,7 +43,6 @@ DragState::SetOrigin(BPoint origin)
}
// ActionName
const char*
DragState::ActionName() const
{
@@ -52,15 +50,6 @@ DragState::ActionName() const
}
// ActionNameIndex
uint32
DragState::ActionNameIndex() const
{
return TRANSFORMATION;
}
// _SetViewCursor
void
DragState::_SetViewCursor(BView* view, const uchar* cursorData) const
{
@@ -72,7 +61,6 @@ DragState::_SetViewCursor(BView* view, const uchar* cursorData) const
// #pragma mark - DragCornerState
// constructor
DragCornerState::DragCornerState(TransformBox* parent, uint32 corner)
:
DragState(parent),
@@ -81,7 +69,6 @@ DragCornerState::DragCornerState(TransformBox* parent, uint32 corner)
}
// SetOrigin
void
DragCornerState::SetOrigin(BPoint origin)
{
@@ -93,8 +80,7 @@ DragCornerState::SetOrigin(BPoint origin)
// copy the matrix at the start of the drag procedure
fMatrix.reset();
fMatrix.multiply(agg::trans_affine_scaling(fOldXScale, fOldYScale));
fMatrix.multiply(agg::trans_affine_rotation(fParent->LocalRotation()
* M_PI / 180.0));
fMatrix.multiply(agg::trans_affine_rotation(fParent->LocalRotation() * M_PI / 180.0));
fMatrix.multiply(agg::trans_affine_translation(fParent->Translation().x,
fParent->Translation().y));
@@ -143,7 +129,6 @@ DragCornerState::SetOrigin(BPoint origin)
}
// DragTo
void
DragCornerState::DragTo(BPoint current, uint32 modifiers)
{
@@ -182,12 +167,10 @@ DragCornerState::DragTo(BPoint current, uint32 modifiers)
translation.x = x;
translation.y = y;
fParent->SetTranslationAndScale(translation, xScale * fOldXScale,
yScale * fOldYScale);
fParent->SetTranslationAndScale(translation, xScale * fOldXScale, yScale * fOldYScale);
}
// UpdateViewCursor
void
DragCornerState::UpdateViewCursor(BView* view, BPoint current) const
{
@@ -290,7 +273,6 @@ DragCornerState::UpdateViewCursor(BView* view, BPoint current) const
}
// ActionName
const char*
DragCornerState::ActionName() const
{
@@ -298,14 +280,6 @@ DragCornerState::ActionName() const
}
// ActionNameIndex
uint32
DragCornerState::ActionNameIndex() const
{
return SCALE;
}
// #pragma mark - DragSideState
@@ -317,7 +291,6 @@ DragSideState::DragSideState(TransformBox* parent, uint32 side)
}
// SetOrigin
void
DragSideState::SetOrigin(BPoint origin)
{
@@ -329,8 +302,7 @@ DragSideState::SetOrigin(BPoint origin)
// copy the matrix at the start of the drag procedure
fMatrix.reset();
fMatrix.multiply(agg::trans_affine_scaling(fOldXScale, fOldYScale));
fMatrix.multiply(agg::trans_affine_rotation(fParent->LocalRotation()
* M_PI / 180.0));
fMatrix.multiply(agg::trans_affine_rotation(fParent->LocalRotation() * M_PI / 180.0));
fMatrix.multiply(agg::trans_affine_translation(fParent->Translation().x,
fParent->Translation().y));
@@ -367,7 +339,6 @@ DragSideState::SetOrigin(BPoint origin)
}
// DragTo
void
DragSideState::DragTo(BPoint current, uint32 modifiers)
{
@@ -400,12 +371,10 @@ DragSideState::DragTo(BPoint current, uint32 modifiers)
translation.x = x;
translation.y = y;
fParent->SetTranslationAndScale(translation, xScale * fOldXScale,
yScale * fOldYScale);
fParent->SetTranslationAndScale(translation, xScale * fOldXScale, yScale * fOldYScale);
}
// UpdateViewCursor
void
DragSideState::UpdateViewCursor(BView* view, BPoint current) const
{
@@ -458,7 +427,6 @@ DragSideState::UpdateViewCursor(BView* view, BPoint current) const
}
// ActionName
const char*
DragSideState::ActionName() const
{
@@ -466,18 +434,9 @@ DragSideState::ActionName() const
}
// ActionNameIndex
uint32
DragSideState::ActionNameIndex() const
{
return SCALE;
}
// #pragma mark - DragBoxState
// SetOrigin
void
DragBoxState::SetOrigin(BPoint origin)
{
@@ -486,7 +445,6 @@ DragBoxState::SetOrigin(BPoint origin)
}
// DragTo
void
DragBoxState::DragTo(BPoint current, uint32 modifiers)
{
@@ -502,7 +460,6 @@ DragBoxState::DragTo(BPoint current, uint32 modifiers)
}
// UpdateViewCursor
void
DragBoxState::UpdateViewCursor(BView* view, BPoint current) const
{
@@ -510,7 +467,6 @@ DragBoxState::UpdateViewCursor(BView* view, BPoint current) const
}
// ActionName
const char*
DragBoxState::ActionName() const
{
@@ -518,18 +474,9 @@ DragBoxState::ActionName() const
}
// ActionNameIndex
uint32
DragBoxState::ActionNameIndex() const
{
return MOVE;
}
// #pragma mark - RotateBoxState
// constructor
RotateBoxState::RotateBoxState(TransformBox* parent)
:
DragState(parent),
@@ -538,7 +485,6 @@ RotateBoxState::RotateBoxState(TransformBox* parent)
}
// SetOrigin
void
RotateBoxState::SetOrigin(BPoint origin)
{
@@ -547,7 +493,6 @@ RotateBoxState::SetOrigin(BPoint origin)
}
// DragTo
void
RotateBoxState::DragTo(BPoint current, uint32 modifiers)
{
@@ -567,7 +512,6 @@ RotateBoxState::DragTo(BPoint current, uint32 modifiers)
}
// UpdateViewCursor
void
RotateBoxState::UpdateViewCursor(BView* view, BPoint current) const
{
@@ -599,7 +543,6 @@ RotateBoxState::UpdateViewCursor(BView* view, BPoint current) const
}
// ActionName
const char*
RotateBoxState::ActionName() const
{
@@ -607,18 +550,9 @@ RotateBoxState::ActionName() const
}
// ActionNameIndex
uint32
RotateBoxState::ActionNameIndex() const
{
return ROTATE;
}
// #pragma mark - OffsetCenterState
// SetOrigin
void
OffsetCenterState::SetOrigin(BPoint origin)
{
@@ -627,7 +561,6 @@ OffsetCenterState::SetOrigin(BPoint origin)
}
// DragTo
void
OffsetCenterState::DragTo(BPoint current, uint32 modifiers)
{
@@ -637,7 +570,6 @@ OffsetCenterState::DragTo(BPoint current, uint32 modifiers)
}
// UpdateViewCursor
void
OffsetCenterState::UpdateViewCursor(BView* view, BPoint current) const
{
@@ -645,17 +577,8 @@ OffsetCenterState::UpdateViewCursor(BView* view, BPoint current) const
}
// ActionName
const char*
OffsetCenterState::ActionName() const
{
return B_TRANSLATE("Move Pivot");
}
// ActionNameIndex
uint32
OffsetCenterState::ActionNameIndex() const
{
return MOVE_PIVOT;
}
@@ -1,9 +1,10 @@
/*
* Copyright 2006, Haiku.
* Copyright 2006, 2023, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
* Stephan Aßmus <superstippi@gmx.de>
* Zardshard
*/
#ifndef TRANSFORM_BOX_STATES_H
@@ -16,15 +17,6 @@
class BView;
class TransformBox;
// TODO: remove and replace with translation string indices once multiple
// languages are supported
#define TRANSFORMATION 0
#define ROTATE 0
#define MOVE 0
#define SCALE 0
#define MOVE_PIVOT 0
//
// base class
class DragState {
public:
@@ -36,11 +28,9 @@ class DragState {
virtual void UpdateViewCursor(BView* view, BPoint current) const = 0;
virtual const char* ActionName() const;
virtual uint32 ActionNameIndex() const;
protected:
void _SetViewCursor(BView* view,
const uchar* cursorData) const;
void _SetViewCursor(BView* view, const uchar* cursorData) const;
BPoint fOrigin;
TransformBox* fParent;
@@ -55,8 +45,7 @@ class DragCornerState : public DragState {
LEFT_BOTTOM_CORNER,
RIGHT_BOTTOM_CORNER,
};
DragCornerState(TransformBox* parent,
uint32 corner);
DragCornerState(TransformBox* parent, uint32 corner);
virtual ~DragCornerState() {}
virtual void SetOrigin(BPoint origin);
@@ -64,7 +53,6 @@ class DragCornerState : public DragState {
virtual void UpdateViewCursor(BView* view, BPoint current) const;
virtual const char* ActionName() const;
virtual uint32 ActionNameIndex() const;
private:
uint32 fCorner;
@@ -87,8 +75,7 @@ class DragSideState : public DragState {
RIGHT_SIDE,
BOTTOM_SIDE,
};
DragSideState(TransformBox* parent,
uint32 side);
DragSideState(TransformBox* parent, uint32 side);
virtual ~DragSideState() {}
virtual void SetOrigin(BPoint origin);
@@ -96,7 +83,6 @@ class DragSideState : public DragState {
virtual void UpdateViewCursor(BView* view, BPoint current) const;
virtual const char* ActionName() const;
virtual uint32 ActionNameIndex() const;
private:
uint32 fSide;
@@ -121,7 +107,6 @@ class DragBoxState : public DragState {
virtual void UpdateViewCursor(BView* view, BPoint current) const;
virtual const char* ActionName() const;
virtual uint32 ActionNameIndex() const;
private:
BPoint fOldTranslation;
@@ -138,7 +123,6 @@ class RotateBoxState : public DragState {
virtual void UpdateViewCursor(BView* view, BPoint current) const;
virtual const char* ActionName() const;
virtual uint32 ActionNameIndex() const;
private:
double fOldAngle;
@@ -156,8 +140,6 @@ class OffsetCenterState : public DragState {
virtual void UpdateViewCursor(BView* view, BPoint current) const;
virtual const char* ActionName() const;
virtual uint32 ActionNameIndex() const;
};
#endif // TRANSFORM_BOX_STATES_H
@@ -16,8 +16,7 @@ TransformCommand::TransformCommand(BPoint pivot,
double rotation,
double xScale,
double yScale,
const char* actionName,
uint32 nameIndex)
const char* actionName)
: Command(),
fOldPivot(pivot),
fOldTranslation(translation),
@@ -31,14 +30,12 @@ TransformCommand::TransformCommand(BPoint pivot,
fNewXScale(xScale),
fNewYScale(yScale),
fName(actionName),
fNameIndex(nameIndex)
fName(actionName)
{
}
// constructor
TransformCommand::TransformCommand(const char* actionName,
uint32 nameIndex)
TransformCommand::TransformCommand(const char* actionName)
: Command(),
fOldPivot(B_ORIGIN),
fOldTranslation(B_ORIGIN),
@@ -52,8 +49,7 @@ TransformCommand::TransformCommand(const char* actionName,
fNewXScale(1.0),
fNewYScale(1.0),
fName(actionName),
fNameIndex(nameIndex)
fName(actionName)
{
}
@@ -112,7 +108,7 @@ TransformCommand::Redo()
void
TransformCommand::GetName(BString& name)
{
name << _GetString(fNameIndex, fName.String());
name << fName.String();
}
// SetNewTransformation
@@ -140,9 +136,7 @@ TransformCommand::SetNewTranslation(BPoint translation)
// SetName
void
TransformCommand::SetName(const char* actionName, uint32 nameIndex)
TransformCommand::SetName(const char* actionName)
{
fName.SetTo(actionName);
fNameIndex = nameIndex;
}
@@ -22,11 +22,9 @@ class TransformCommand : public Command {
double xScale,
double yScale,
const char* actionName,
uint32 nameIndex);
const char* actionName);
TransformCommand(const char* actionName,
uint32 nameIndex);
TransformCommand(const char* actionName);
virtual ~TransformCommand();
@@ -49,8 +47,7 @@ class TransformCommand : public Command {
void SetNewTranslation(BPoint translation);
// convinience for "nudging"
void SetName(const char* actionName,
uint32 nameIndex);
void SetName(const char* actionName);
protected:
virtual status_t _SetTransformation(BPoint pivot,
@@ -72,7 +69,6 @@ class TransformCommand : public Command {
double fNewYScale;
BString fName;
uint32 fNameIndex;
};
#endif // TRANSFORM_COMMAND_H
@@ -178,10 +178,10 @@ TransformGradientBox::ViewSpaceRotation() const
// MakeCommand
TransformCommand*
TransformGradientBox::MakeCommand(const char* commandName, uint32 nameIndex)
TransformGradientBox::MakeCommand(const char* commandName)
{
return new TransformGradientCommand(this, fGradient, Pivot(),
Translation(), LocalRotation(), LocalXScale(), LocalYScale(),
commandName, nameIndex);
commandName);
}
@@ -42,8 +42,7 @@ class TransformGradientBox : public TransformBox {
virtual float ZoomLevel() const;
virtual double ViewSpaceRotation() const;
virtual TransformCommand* MakeCommand(const char* actionName,
uint32 nameIndex);
virtual TransformCommand* MakeCommand(const char* actionName);
// TransformGradientBox
Command* Perform();
@@ -17,10 +17,9 @@ using std::nothrow;
TransformGradientCommand::TransformGradientCommand(TransformBox* box,
Gradient* gradient, BPoint pivot, BPoint translation, double rotation,
double xScale, double yScale, const char* name, int32 nameIndex)
double xScale, double yScale, const char* name)
:
TransformCommand(pivot, translation, rotation, xScale, yScale, name,
nameIndex),
TransformCommand(pivot, translation, rotation, xScale, yScale, name),
fTransformBox(box),
fGradient(gradient)
{
@@ -25,8 +25,7 @@ public:
TransformBox* box, Gradient* gradient,
BPoint pivot, BPoint translation,
double rotation, double xScale,
double yScale, const char* name,
int32 nameIndex);
double yScale, const char* name);
virtual ~TransformGradientCommand();
// Command interface
@@ -28,15 +28,13 @@ TransformObjectsCommand::TransformObjectsCommand(
double xScale,
double yScale,
const char* name,
int32 nameIndex)
const char* name)
: TransformCommand(pivot,
translation,
rotation,
xScale,
yScale,
name,
nameIndex),
name),
fTransformBox(box),
fObjects(objects && count > 0 ?
new (nothrow) Transformable*[count] : NULL),
@@ -36,8 +36,7 @@ class TransformObjectsCommand : public TransformCommand,
double xScale,
double yScale,
const char* name,
int32 nameIndex);
const char* name);
virtual ~TransformObjectsCommand();
// Command interface
@@ -117,8 +117,7 @@ TransformPointsBox::Update(bool deep)
// MakeCommand
TransformCommand*
TransformPointsBox::MakeCommand(const char* commandName,
uint32 nameIndex)
TransformPointsBox::MakeCommand(const char* commandName)
{
return new TransformPointsCommand(this, fPath,
@@ -132,8 +131,7 @@ TransformPointsBox::MakeCommand(const char* commandName,
LocalXScale(),
LocalYScale(),
commandName,
nameIndex);
commandName);
}
// #pragma mark -
@@ -40,8 +40,7 @@ class TransformPointsBox : public CanvasTransformBox {
// TransformBox interface
virtual void Update(bool deep = true);
virtual TransformCommand* MakeCommand(const char* commandName,
uint32 nameIndex);
virtual TransformCommand* MakeCommand(const char* commandName);
// TransformPointsBox
void Cancel();
@@ -129,7 +129,7 @@ TransformShapesBox::ObjectChanged(const Observable* object)
// MakeCommand
TransformCommand*
TransformShapesBox::MakeCommand(const char* commandName, uint32 nameIndex)
TransformShapesBox::MakeCommand(const char* commandName)
{
Transformable* objects[fCount];
for (int32 i = 0; i < fCount; i++)
@@ -143,7 +143,6 @@ TransformShapesBox::MakeCommand(const char* commandName, uint32 nameIndex)
LocalXScale(),
LocalYScale(),
commandName,
nameIndex);
commandName);
}
@@ -33,8 +33,7 @@ class TransformShapesBox : public CanvasTransformBox {
// TransformBox interface
virtual void Update(bool deep = true);
virtual TransformCommand* MakeCommand(const char* actionName,
uint32 nameIndex);
virtual TransformCommand* MakeCommand(const char* actionName);
// TransformShapesBox
Shape** Shapes() const