mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-16 05:42:32 +00:00
parent
3c3914c7d8
commit
ccee49c02b
16
data/gui.xml
16
data/gui.xml
@ -454,6 +454,12 @@
|
||||
<param name="format" value="indexed" />
|
||||
<param name="dithering" value="old-ordered" />
|
||||
</key>
|
||||
<key command="ChangeBrush">
|
||||
<param name="change" value="increment-angle" />
|
||||
</key>
|
||||
<key command="ChangeBrush">
|
||||
<param name="change" value="decrement-angle" />
|
||||
</key>
|
||||
</commands>
|
||||
|
||||
<!-- Keyboard shortcuts to select tools -->
|
||||
@ -992,19 +998,19 @@
|
||||
</menu>
|
||||
|
||||
<menu id="ink_popup_menu">
|
||||
<item command="SetInkType" text="@.simple_ink">
|
||||
<item command="SetInkType" text="@inks.simple_ink">
|
||||
<param name="type" value="simple" />
|
||||
</item>
|
||||
<item command="SetInkType" text="@.alpha_compositing">
|
||||
<item command="SetInkType" text="@inks.alpha_compositing">
|
||||
<param name="type" value="alpha-compositing" />
|
||||
</item>
|
||||
<item command="SetInkType" text="@.copy_color">
|
||||
<item command="SetInkType" text="@inks.copy_color">
|
||||
<param name="type" value="copy-color" />
|
||||
</item>
|
||||
<item command="SetInkType" text="@.lock_alpha">
|
||||
<item command="SetInkType" text="@inks.lock_alpha">
|
||||
<param name="type" value="lock-alpha" />
|
||||
</item>
|
||||
<item command="SetInkType" text="@.shading">
|
||||
<item command="SetInkType" text="@inks.shading">
|
||||
<param name="type" value="shading" />
|
||||
</item>
|
||||
<separator />
|
||||
|
@ -164,10 +164,221 @@ unlink = &Unlink
|
||||
link_cels = &Link Cels
|
||||
|
||||
[commands]
|
||||
About = About
|
||||
AddColor = Add {0} Color to Palette
|
||||
AddColor_Background = Background
|
||||
AddColor_Foreground = Foreground
|
||||
AddColor_Specific = Specific
|
||||
AdvancedMode = Advanced Mode
|
||||
AutocropSprite = Trim Sprite
|
||||
BackgroundFromLayer = Background From Layer
|
||||
BrightnessContrast = Adjust Brightness/Contrast
|
||||
Cancel = Cancel Current Operation
|
||||
CanvasSize = Canvas Size
|
||||
CelProperties = Cel Properties
|
||||
ChangeBrush = Change Brush: {0}
|
||||
ChangeBrush_CustomBrush = Custom Brush #{0}
|
||||
ChangeBrush_DecrementAngle = Decrement Angle
|
||||
ChangeBrush_DecrementSize = Decrement Size
|
||||
ChangeBrush_IncrementAngle = Increment Angle
|
||||
ChangeBrush_IncrementSize = Increment Size
|
||||
ChangeColor = Change Color: {0}
|
||||
ChangeColor_IncrementFgIndex = Increment Foreground Index
|
||||
ChangeColor_DecrementFgIndex = Decrement Foreground Index
|
||||
ChangeColor_IncrementBgIndex = Increment Background Index
|
||||
ChangeColor_DecrementBgIndex = Decrement Background Index
|
||||
ChangePixelFormat = Change Color Mode: {0}
|
||||
ChangePixelFormat_RGB = RGB
|
||||
ChangePixelFormat_Grayscale = Grayscale
|
||||
ChangePixelFormat_Indexed = Indexed
|
||||
ChangePixelFormat_Indexed_OrderedDithering = Indexed with Ordered Dithering
|
||||
ChangePixelFormat_Indexed_OldDithering = Indexed with Old Dithering
|
||||
ChangePixelFormat_Indexed = Indexed
|
||||
Clear = Clear
|
||||
ClearCel = Clear Cel
|
||||
CloseAllFiles = Close All Files
|
||||
CloseFile = Close File
|
||||
ColorCurve = Color Curve
|
||||
ColorQuantization = Create Palette from Current Sprite (Color Quantization)
|
||||
ContiguousFill = Switch Contiguous Fill
|
||||
ConvolutionMatrix = Convolution Matrix
|
||||
Copy = Copy
|
||||
CopyCel = Copy Cel
|
||||
CopyMerged = Copy Merged
|
||||
CropSprite = Crop Sprite
|
||||
Cut = Cut
|
||||
DeselectMask = Deselect Mask
|
||||
Despeckle = Despeckle
|
||||
DeveloperConsole = Developer Console
|
||||
DiscardBrush = Discard Brush
|
||||
DuplicateLayer = Duplicate Layer
|
||||
DuplicateSprite = Duplicate Sprite
|
||||
DuplicateView = Duplicate View
|
||||
Exit = Exit
|
||||
ExportSpriteSheet = Export Sprite Sheet
|
||||
Eyedropper = Eyedropper
|
||||
FitScreen = Fit on Screen
|
||||
FlattenLayers = Flatten Layers
|
||||
Flip = Flip {0} {1}
|
||||
Flip_Canvas = Canvas
|
||||
Flip_Horizontally = Horizontally
|
||||
Flip_Selection = Selection
|
||||
Flip_Vertically = Vertically
|
||||
FrameProperties = Frame Properties
|
||||
FrameTagProperties = Frame Tag Properties
|
||||
FullscreenPreview = Fullscreen Preview
|
||||
GotoFirstFrame = Go to First Frame
|
||||
GotoFrame = Go to Frame
|
||||
GotoLastFrame = Go to Last Frame
|
||||
GotoNextFrame = Go to Next Frame
|
||||
GotoNextFrameWithSameTag = Go to Next Frame with same tag
|
||||
GotoNextLayer = Go to Next Layer
|
||||
GotoNextTab = Go to Next Tab
|
||||
GotoPreviousFrame = Go to Previous Frame
|
||||
GotoPreviousFrameWithSameTag = Go to Previous Frame with same tag
|
||||
GotoPreviousLayer = Go to Previous Layer
|
||||
GotoPreviousTab = Go to Previous tab
|
||||
GridSettings = Grid Settings
|
||||
Home = Home
|
||||
HueSaturation = Adjust Hue/Saturation
|
||||
ImportSpriteSheet = Import Sprite Sheet
|
||||
InvertColor = Invert Color
|
||||
InvertMask = Invert Selection
|
||||
KeyboardShortcuts = Keyboard Shortcuts
|
||||
Launch = Launch
|
||||
LayerFromBackground = Layer From Background
|
||||
LayerLock = Lock Layers
|
||||
LayerOpacity = Set Layer Opacity to {0} ({1}%)
|
||||
LayerProperties = Layer Properties
|
||||
LayerVisibility = Layer Visibility
|
||||
LinkCels = Links Cels
|
||||
LoadMask = Load Selection
|
||||
LoadPalette = Load Palette
|
||||
MaskAll = Mask All
|
||||
MaskByColor = Mask By Color
|
||||
MaskContent = Mask Content
|
||||
MergeDownLayer = Merge Down Layer
|
||||
ModifySelection = {0} Selection {1}
|
||||
ModifySelection_Border = Border
|
||||
ModifySelection_Expand = Expand
|
||||
ModifySelection_Contract = Contract
|
||||
ModifySelection_Modify = Modify
|
||||
ModifySelection_Quantity = by {0} pixel(s)
|
||||
Move_Thing = {0} {1} {2}
|
||||
Move_Pixel = pixel(s)
|
||||
Move_TileWidth = tile(s) width
|
||||
Move_TileHeight = tile(s) height
|
||||
Move_ZoomedPixel = zoomed pixel(s)
|
||||
Move_ZoomedTileWidth = zoomed tile(s) width
|
||||
Move_ZoomedTileHeight = zoomed tile(s) height
|
||||
Move_ViewportWidth = viewport width
|
||||
Move_ViewportHeight = viewport height
|
||||
Move_Left = left
|
||||
Move_Right = right
|
||||
Move_Up = up
|
||||
Move_Down = down
|
||||
MoveCel = Move Cel
|
||||
MoveMask = Move {0} {1}
|
||||
MoveMask_Boundaries = Selection Boundaries
|
||||
MoveMask_Content = Selection Content
|
||||
NewBrush = New Brush
|
||||
NewFile = New File
|
||||
NewFrame = New Frame
|
||||
NewFrame_NewEmptyFrame = New Empty Frame
|
||||
NewFrame_DuplicateCels = Duplicate Linked Cels
|
||||
NewFrame_DuplicateCelsBlock = Duplicate Cels
|
||||
NewFrameTag = New Frame Tag
|
||||
NewLayer = New Layer
|
||||
NewSpriteFromSelection = New Sprite From Selection
|
||||
OpenBrowser = Open Browser
|
||||
OpenFile = Open Sprite
|
||||
OpenGroup = Open/Close Group
|
||||
OpenInFolder = Open In Folder
|
||||
OpenWithApp = Open With Associated Application
|
||||
Options = Preferences
|
||||
PaletteEditor = Switch{0}{1}{2}
|
||||
PaletteEditor_Edit = <<<END
|
||||
Edit Palette Mode
|
||||
END
|
||||
PaletteEditor_And = <<<END
|
||||
and
|
||||
END
|
||||
PaletteEditor_FgPopup = <<<END
|
||||
Foreground Color Popup
|
||||
END
|
||||
PaletteEditor_BgPopup = <<<END
|
||||
Background Color Popup
|
||||
END
|
||||
PaletteSize = Palette Size
|
||||
Paste = Paste
|
||||
PasteText = Insert Text
|
||||
PixelPerfectMode = Switch Pixel Perfect Mode
|
||||
PlayAnimation = Play Animation
|
||||
Redo = Redo
|
||||
Refresh = Refresh
|
||||
RemoveFrame = Remove Frame
|
||||
RemoveFrameTag = Remove Frame Tag
|
||||
RemoveLayer = Remove Layer
|
||||
RemoveSlice = Remove Slice
|
||||
RepeatLastExport = Repeat Last Export
|
||||
ReplaceColor = Replace Color
|
||||
ReselectMask = Reselect Mask
|
||||
ReverseFrames = Reverse Frames
|
||||
Rotate = Rotate {0} {1}
|
||||
Rotate_Selection = Selection
|
||||
Rotate_Sprite = Sprite
|
||||
RunScript = Run Script
|
||||
SaveFile = Save File
|
||||
SaveFileAs = Save File As
|
||||
SaveFileCopyAs = Export
|
||||
SaveMask = Save Selection
|
||||
SavePalette = Save Palette
|
||||
Scroll = Scroll {0}
|
||||
ScrollCenter = Scroll to center of canvas
|
||||
SelectTile = Select Tile
|
||||
SelectTile_Add = Select Tile (Add)
|
||||
SelectTile_Subtract = Select Tile (Subtract)
|
||||
SelectionAsGrid = Selection as Grid
|
||||
SetColorSelector = Set Color Selector
|
||||
SetColorSelector_Spectrum = Color Spectrum
|
||||
SetColorSelector_TintShadeTone = Color Tint/Shade/Tone
|
||||
SetColorSelector_RGBWheel = RGB Color Wheel
|
||||
SetColorSelector_RYBWheel = RYB Color Wheel
|
||||
SetInkType = Set Ink Type: {0}
|
||||
SetLoopSection = Set Loop Section
|
||||
SetPalette = Set Palette
|
||||
SetPaletteEntrySize = Set Palette Entry Size
|
||||
SetSameInk = Same Ink in All Tools
|
||||
ShowAutoGuides = Show Auto Guides
|
||||
ShowBrushPreview = Show Brush Preview
|
||||
ShowBrushes = Show Brushes
|
||||
ShowExtras = Show Extras
|
||||
ShowGrid = Show Grid
|
||||
ShowLayerEdges = Show Layer Edges
|
||||
ShowOnionSkin = Show Onion Skin
|
||||
ShowPaletteOptions = Show Palette Options
|
||||
ShowPalettePresets = Show Palette Presets
|
||||
ShowPaletteSortOptions = Show Palette Sort Options
|
||||
ShowPixelGrid = Show Pixel Grid
|
||||
ShowSelectionEdges = Show Selection Edges
|
||||
ShowSlices = Show Slices
|
||||
SliceProperties = Slice Properties
|
||||
SnapToGrid = Snap to Grid
|
||||
SpriteProperties = Sprite Properties
|
||||
SpriteSize = Sprite Size
|
||||
SwitchColors = Switch Colors
|
||||
SymmetryMode = Symmetry Mode
|
||||
TiledMode = Tiled Mode
|
||||
Timeline = Switch Timeline
|
||||
TogglePreview = Toggle Preview
|
||||
ToggleTimelineThumbnails = Toggle Timeline Thumbnails
|
||||
Undo = Undo
|
||||
UndoHistory = Undo History
|
||||
UnlinkCel = Unlink Cel
|
||||
Zoom = Zoom
|
||||
Zoom_In = Zoom In
|
||||
Zoom_Out = Zoom Out
|
||||
Zoom_Set = Zoom {0}%
|
||||
|
||||
[document_tab_popup_menu]
|
||||
duplicate_view = Duplicate &View
|
||||
@ -338,12 +549,14 @@ partial_tiles = Include partial tiles at bottom/right edges
|
||||
import = &Import
|
||||
cancel = &Cancel
|
||||
|
||||
[ink_popup_menu]
|
||||
[inks]
|
||||
simple_ink = Simple Ink
|
||||
alpha_compositing = Alpha Compositing
|
||||
copy_color = Copy Alpha+Color
|
||||
lock_alpha = Lock Alpha
|
||||
shading = Shading
|
||||
|
||||
[ink_popup_menu]
|
||||
same_in_all_tools = Same in all Tools
|
||||
|
||||
[jpeg_options]
|
||||
|
@ -364,6 +364,7 @@ add_library(app-lib
|
||||
commands/filters/filter_target_buttons.cpp
|
||||
commands/filters/filter_window.cpp
|
||||
commands/filters/filter_worker.cpp
|
||||
commands/move_thing.cpp
|
||||
commands/quick_command.cpp
|
||||
console.cpp
|
||||
context.cpp
|
||||
|
@ -29,9 +29,7 @@ protected:
|
||||
};
|
||||
|
||||
AboutCommand::AboutCommand()
|
||||
: Command("About",
|
||||
"About",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("About", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -15,12 +15,14 @@
|
||||
#include "app/console.h"
|
||||
#include "app/context.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/modules/palettes.h"
|
||||
#include "app/transaction.h"
|
||||
#include "app/ui/color_bar.h"
|
||||
#include "app/ui/context_bar.h"
|
||||
#include "app/ui/editor/editor.h"
|
||||
#include "doc/palette.h"
|
||||
#include "fmt/format.h"
|
||||
#include "ui/manager.h"
|
||||
|
||||
namespace app {
|
||||
@ -43,9 +45,7 @@ protected:
|
||||
};
|
||||
|
||||
AddColorCommand::AddColorCommand()
|
||||
: Command("AddColor",
|
||||
"Add Color",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("AddColor", CmdUIOnlyFlag)
|
||||
, m_source(Source::Fg)
|
||||
{
|
||||
}
|
||||
@ -121,7 +121,7 @@ void AddColorCommand::onExecute(Context* ctx)
|
||||
if (document) {
|
||||
frame_t frame = writer.frame();
|
||||
|
||||
Transaction transaction(writer.context(), "Add Color", ModifyDocument);
|
||||
Transaction transaction(writer.context(), friendlyName(), ModifyDocument);
|
||||
transaction.execute(new cmd::SetPalette(sprite, frame, newPalette));
|
||||
transaction.commit();
|
||||
}
|
||||
@ -136,16 +136,13 @@ void AddColorCommand::onExecute(Context* ctx)
|
||||
|
||||
std::string AddColorCommand::onGetFriendlyName() const
|
||||
{
|
||||
std::string text = "Add ";
|
||||
|
||||
std::string source;
|
||||
switch (m_source) {
|
||||
case Source::Fg: text += "Foreground"; break;
|
||||
case Source::Bg: text += "Background"; break;
|
||||
case Source::Color: text += "Specific"; break;
|
||||
case Source::Fg: source = Strings::commands_AddColor_Foreground(); break;
|
||||
case Source::Bg: source = Strings::commands_AddColor_Background(); break;
|
||||
case Source::Color: source = Strings::commands_AddColor_Specific(); break;
|
||||
}
|
||||
|
||||
text += " Color to Palette";
|
||||
return text;
|
||||
return fmt::format(getBaseFriendlyName(), source);
|
||||
}
|
||||
|
||||
Command* CommandFactory::createAddColorCommand()
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -33,9 +33,7 @@ protected:
|
||||
};
|
||||
|
||||
AdvancedModeCommand::AdvancedModeCommand()
|
||||
: Command("AdvancedMode",
|
||||
"Advanced Mode",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("AdvancedMode", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -12,8 +12,8 @@
|
||||
#include "app/context_access.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/ui/color_bar.h"
|
||||
#include "app/transaction.h"
|
||||
#include "app/ui/color_bar.h"
|
||||
#include "doc/layer.h"
|
||||
#include "doc/sprite.h"
|
||||
|
||||
@ -30,9 +30,7 @@ protected:
|
||||
};
|
||||
|
||||
BackgroundFromLayerCommand::BackgroundFromLayerCommand()
|
||||
: Command("BackgroundFromLayer",
|
||||
"Background From Layer",
|
||||
CmdRecordableFlag)
|
||||
: Command("BackgroundFromLayer", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015, 2017 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -38,9 +38,7 @@ private:
|
||||
};
|
||||
|
||||
CancelCommand::CancelCommand()
|
||||
: Command("Cancel",
|
||||
"Cancel Current Operation",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("Cancel", CmdUIOnlyFlag)
|
||||
, m_type(NoOp)
|
||||
{
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -281,9 +281,7 @@ protected:
|
||||
};
|
||||
|
||||
CanvasSizeCommand::CanvasSizeCommand()
|
||||
: Command("CanvasSize",
|
||||
"Canvas Size",
|
||||
CmdRecordableFlag)
|
||||
: Command("CanvasSize", CmdRecordableFlag)
|
||||
{
|
||||
m_left = m_right = m_top = m_bottom = 0;
|
||||
}
|
||||
|
@ -282,9 +282,7 @@ protected:
|
||||
};
|
||||
|
||||
CelPropertiesCommand::CelPropertiesCommand()
|
||||
: Command("CelProperties",
|
||||
"Cel Properties",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("CelProperties", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -14,12 +14,14 @@
|
||||
#include "app/commands/command.h"
|
||||
#include "app/commands/params.h"
|
||||
#include "app/context.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/pref/preferences.h"
|
||||
#include "app/tools/active_tool.h"
|
||||
#include "app/tools/tool.h"
|
||||
#include "app/ui/context_bar.h"
|
||||
#include "base/convert_to.h"
|
||||
#include "doc/brush.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
@ -48,9 +50,7 @@ private:
|
||||
};
|
||||
|
||||
ChangeBrushCommand::ChangeBrushCommand()
|
||||
: Command("ChangeBrush",
|
||||
"Change Brush",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("ChangeBrush", CmdUIOnlyFlag)
|
||||
{
|
||||
m_change = None;
|
||||
m_slot = 0;
|
||||
@ -108,30 +108,18 @@ void ChangeBrushCommand::onExecute(Context* context)
|
||||
|
||||
std::string ChangeBrushCommand::onGetFriendlyName() const
|
||||
{
|
||||
std::string text = "Brush";
|
||||
|
||||
std::string change;
|
||||
switch (m_change) {
|
||||
case None:
|
||||
break;
|
||||
case IncrementSize:
|
||||
text += ": Increment Size";
|
||||
break;
|
||||
case DecrementSize:
|
||||
text += ": Decrement Size";
|
||||
break;
|
||||
case IncrementAngle:
|
||||
text += ": Increment Angle";
|
||||
break;
|
||||
case DecrementAngle:
|
||||
text += ": Decrement Angle";
|
||||
break;
|
||||
case None: break;
|
||||
case IncrementSize: change = Strings::commands_ChangeBrush_IncrementSize(); break;
|
||||
case DecrementSize: change = Strings::commands_ChangeBrush_DecrementSize(); break;
|
||||
case IncrementAngle: change = Strings::commands_ChangeBrush_IncrementAngle(); break;
|
||||
case DecrementAngle: change = Strings::commands_ChangeBrush_DecrementAngle(); break;
|
||||
case CustomBrush:
|
||||
text += ": Custom Brush #";
|
||||
text += base::convert_to<std::string>(m_slot);
|
||||
change = fmt::format(Strings::commands_ChangeBrush_CustomBrush(), m_slot);
|
||||
break;
|
||||
}
|
||||
|
||||
return text;
|
||||
return fmt::format(getBaseFriendlyName(), change);
|
||||
}
|
||||
|
||||
Command* CommandFactory::createChangeBrushCommand()
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -13,9 +13,11 @@
|
||||
#include "app/app.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/commands/params.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/modules/palettes.h"
|
||||
#include "app/ui/color_bar.h"
|
||||
#include "doc/palette.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
@ -45,9 +47,7 @@ protected:
|
||||
};
|
||||
|
||||
ChangeColorCommand::ChangeColorCommand()
|
||||
: Command("ChangeColor",
|
||||
"Change Color",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("ChangeColor", CmdUIOnlyFlag)
|
||||
{
|
||||
m_background = false;
|
||||
m_change = None;
|
||||
@ -96,25 +96,26 @@ void ChangeColorCommand::onExecute(Context* context)
|
||||
|
||||
std::string ChangeColorCommand::onGetFriendlyName() const
|
||||
{
|
||||
std::string text = "Color";
|
||||
std::string action;
|
||||
|
||||
switch (m_change) {
|
||||
case None:
|
||||
return text;
|
||||
break;
|
||||
case IncrementIndex:
|
||||
text += ": Increment";
|
||||
if (m_background)
|
||||
action = Strings::commands_ChangeColor_IncrementBgIndex();
|
||||
else
|
||||
action = Strings::commands_ChangeColor_IncrementFgIndex();
|
||||
break;
|
||||
case DecrementIndex:
|
||||
text += ": Decrement";
|
||||
if (m_background)
|
||||
action = Strings::commands_ChangeColor_DecrementBgIndex();
|
||||
else
|
||||
action = Strings::commands_ChangeColor_DecrementFgIndex();
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_background)
|
||||
text += " Background Index";
|
||||
else
|
||||
text += " Foreground Index";
|
||||
|
||||
return text;
|
||||
return fmt::format(getBaseFriendlyName(), action);
|
||||
}
|
||||
|
||||
Command* CommandFactory::createChangeColorCommand()
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "app/commands/params.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/extensions.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/load_matrix.h"
|
||||
#include "app/modules/editors.h"
|
||||
#include "app/modules/gui.h"
|
||||
@ -28,6 +29,7 @@
|
||||
#include "base/thread.h"
|
||||
#include "doc/image.h"
|
||||
#include "doc/sprite.h"
|
||||
#include "fmt/format.h"
|
||||
#include "render/dithering_algorithm.h"
|
||||
#include "render/ordered_dither.h"
|
||||
#include "render/quantization.h"
|
||||
@ -349,9 +351,7 @@ private:
|
||||
};
|
||||
|
||||
ChangePixelFormatCommand::ChangePixelFormatCommand()
|
||||
: Command("ChangePixelFormat",
|
||||
"Change Pixel Format",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("ChangePixelFormat", CmdUIOnlyFlag)
|
||||
{
|
||||
m_useUI = true;
|
||||
m_format = IMAGE_RGB;
|
||||
@ -488,33 +488,33 @@ void ChangePixelFormatCommand::onExecute(Context* context)
|
||||
|
||||
std::string ChangePixelFormatCommand::onGetFriendlyName() const
|
||||
{
|
||||
std::string text = "Change Color Mode";
|
||||
std::string conversion;
|
||||
|
||||
if (!m_useUI) {
|
||||
switch (m_format) {
|
||||
case IMAGE_RGB:
|
||||
text += " to RGB";
|
||||
break;
|
||||
case IMAGE_INDEXED:
|
||||
text += " to Indexed";
|
||||
switch (m_ditheringAlgorithm) {
|
||||
case render::DitheringAlgorithm::None:
|
||||
break;
|
||||
case render::DitheringAlgorithm::Ordered:
|
||||
text += " with Ordered Dithering";
|
||||
break;
|
||||
case render::DitheringAlgorithm::Old:
|
||||
text += " with Old Dithering";
|
||||
break;
|
||||
}
|
||||
conversion = Strings::commands_ChangePixelFormat_RGB();
|
||||
break;
|
||||
case IMAGE_GRAYSCALE:
|
||||
text += " to Grayscale";
|
||||
conversion = Strings::commands_ChangePixelFormat_Grayscale();
|
||||
break;
|
||||
case IMAGE_INDEXED:
|
||||
switch (m_ditheringAlgorithm) {
|
||||
case render::DitheringAlgorithm::None:
|
||||
conversion = Strings::commands_ChangePixelFormat_Indexed();
|
||||
break;
|
||||
case render::DitheringAlgorithm::Ordered:
|
||||
conversion = Strings::commands_ChangePixelFormat_Indexed_OrderedDithering();
|
||||
break;
|
||||
case render::DitheringAlgorithm::Old:
|
||||
conversion = Strings::commands_ChangePixelFormat_Indexed_OldDithering();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return text;
|
||||
return fmt::format(getBaseFriendlyName(), conversion);
|
||||
}
|
||||
|
||||
Command* CommandFactory::createChangePixelFormatCommand()
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -25,9 +25,7 @@ protected:
|
||||
};
|
||||
|
||||
ClearCommand::ClearCommand()
|
||||
: Command("Clear",
|
||||
"Clear",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("Clear", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -32,9 +32,7 @@ protected:
|
||||
};
|
||||
|
||||
ClearCelCommand::ClearCelCommand()
|
||||
: Command("ClearCel",
|
||||
"Clear Cel",
|
||||
CmdRecordableFlag)
|
||||
: Command("ClearCel", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -30,9 +30,7 @@ using namespace ui;
|
||||
class CloseFileCommand : public Command {
|
||||
public:
|
||||
CloseFileCommand()
|
||||
: Command("CloseFile",
|
||||
"Close File",
|
||||
CmdUIOnlyFlag) {
|
||||
: Command("CloseFile", CmdUIOnlyFlag) {
|
||||
}
|
||||
|
||||
Command* clone() const override { return new CloseFileCommand(*this); }
|
||||
@ -56,9 +54,7 @@ protected:
|
||||
class CloseAllFilesCommand : public Command {
|
||||
public:
|
||||
CloseAllFilesCommand()
|
||||
: Command("CloseAllFiles",
|
||||
"Close All Files",
|
||||
CmdRecordableFlag) {
|
||||
: Command("CloseAllFiles", CmdRecordableFlag) {
|
||||
m_quitting = false;
|
||||
}
|
||||
|
||||
|
@ -43,9 +43,7 @@ protected:
|
||||
};
|
||||
|
||||
ColorQuantizationCommand::ColorQuantizationCommand()
|
||||
: Command("ColorQuantization",
|
||||
"Create Palette from Current Sprite (Color Quantization)",
|
||||
CmdRecordableFlag)
|
||||
: Command("ColorQuantization", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -26,9 +26,7 @@ protected:
|
||||
};
|
||||
|
||||
ContiguousFillCommand::ContiguousFillCommand()
|
||||
: Command("ContiguousFill",
|
||||
"Switch Contiguous Fill",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("ContiguousFill", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -25,9 +25,7 @@ protected:
|
||||
};
|
||||
|
||||
CopyCommand::CopyCommand()
|
||||
: Command("Copy",
|
||||
"Copy",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("Copy", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -27,9 +27,7 @@ protected:
|
||||
};
|
||||
|
||||
CopyCelCommand::CopyCelCommand()
|
||||
: Command("CopyCel",
|
||||
"Copy Cel",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("CopyCel", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2016 David Capello
|
||||
// Copyright (C) 2016-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -25,9 +25,7 @@ protected:
|
||||
};
|
||||
|
||||
CopyMergedCommand::CopyMergedCommand()
|
||||
: Command("CopyMerged",
|
||||
"Copy Merged",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("CopyMerged", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -37,9 +37,7 @@ private:
|
||||
};
|
||||
|
||||
CropSpriteCommand::CropSpriteCommand()
|
||||
: Command("CropSprite",
|
||||
"Crop Sprite",
|
||||
CmdRecordableFlag)
|
||||
: Command("CropSprite", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
@ -92,9 +90,7 @@ protected:
|
||||
};
|
||||
|
||||
AutocropSpriteCommand::AutocropSpriteCommand()
|
||||
: Command("AutocropSprite",
|
||||
"Trim Sprite",
|
||||
CmdRecordableFlag)
|
||||
: Command("AutocropSprite", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -25,9 +25,7 @@ protected:
|
||||
};
|
||||
|
||||
CutCommand::CutCommand()
|
||||
: Command("Cut",
|
||||
"Cut",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("Cut", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
// Copyright (C) 2001-42017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -29,9 +29,7 @@ protected:
|
||||
};
|
||||
|
||||
DeselectMaskCommand::DeselectMaskCommand()
|
||||
: Command("DeselectMask",
|
||||
"Deselect Mask",
|
||||
CmdRecordableFlag)
|
||||
: Command("DeselectMask", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -30,9 +30,7 @@ protected:
|
||||
};
|
||||
|
||||
DeveloperConsoleCommand::DeveloperConsoleCommand()
|
||||
: Command("DeveloperConsole",
|
||||
"Developer Console",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("DeveloperConsole", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -30,9 +30,7 @@ protected:
|
||||
};
|
||||
|
||||
DiscardBrushCommand::DiscardBrushCommand()
|
||||
: Command("DiscardBrush",
|
||||
"Discard Brush",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("DiscardBrush", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -35,9 +35,7 @@ protected:
|
||||
};
|
||||
|
||||
DuplicateLayerCommand::DuplicateLayerCommand()
|
||||
: Command("DuplicateLayer",
|
||||
"Duplicate Layer",
|
||||
CmdRecordableFlag)
|
||||
: Command("DuplicateLayer", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -37,9 +37,7 @@ protected:
|
||||
};
|
||||
|
||||
DuplicateSpriteCommand::DuplicateSpriteCommand()
|
||||
: Command("DuplicateSprite",
|
||||
"Duplicate Sprite",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("DuplicateSprite", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -30,9 +30,7 @@ protected:
|
||||
};
|
||||
|
||||
DuplicateViewCommand::DuplicateViewCommand()
|
||||
: Command("DuplicateView",
|
||||
"Duplicate View",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("DuplicateView", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -29,9 +29,7 @@ protected:
|
||||
};
|
||||
|
||||
ExitCommand::ExitCommand()
|
||||
: Command("Exit",
|
||||
"Exit",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("Exit", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -593,9 +593,7 @@ private:
|
||||
};
|
||||
|
||||
ExportSpriteSheetCommand::ExportSpriteSheetCommand()
|
||||
: Command("ExportSpriteSheet",
|
||||
"Export Sprite Sheet",
|
||||
CmdRecordableFlag)
|
||||
: Command("ExportSpriteSheet", CmdRecordableFlag)
|
||||
, m_useUI(true)
|
||||
, m_askOverwrite(true)
|
||||
{
|
||||
|
@ -32,9 +32,7 @@ namespace app {
|
||||
using namespace ui;
|
||||
|
||||
EyedropperCommand::EyedropperCommand()
|
||||
: Command("Eyedropper",
|
||||
"Eyedropper",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("Eyedropper", CmdUIOnlyFlag)
|
||||
{
|
||||
m_background = false;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -27,9 +27,7 @@ protected:
|
||||
};
|
||||
|
||||
FitScreenCommand::FitScreenCommand()
|
||||
: Command("FitScreen",
|
||||
"Fit on Screen",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("FitScreen", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -29,9 +29,7 @@ protected:
|
||||
};
|
||||
|
||||
FlattenLayersCommand::FlattenLayersCommand()
|
||||
: Command("FlattenLayers",
|
||||
"Flatten Layers",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("FlattenLayers", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "app/context_access.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/document_range.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/transaction.h"
|
||||
#include "app/ui/timeline/timeline.h"
|
||||
@ -32,14 +33,13 @@
|
||||
#include "doc/layer.h"
|
||||
#include "doc/mask.h"
|
||||
#include "doc/sprite.h"
|
||||
#include "fmt/format.h"
|
||||
#include "gfx/size.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
FlipCommand::FlipCommand()
|
||||
: Command("Flip",
|
||||
"Flip",
|
||||
CmdRecordableFlag)
|
||||
: Command("Flip", CmdRecordableFlag)
|
||||
{
|
||||
m_flipMask = false;
|
||||
m_flipType = doc::algorithm::FlipHorizontal;
|
||||
@ -210,19 +210,20 @@ void FlipCommand::onExecute(Context* context)
|
||||
|
||||
std::string FlipCommand::onGetFriendlyName() const
|
||||
{
|
||||
std::string text = "Flip";
|
||||
std::string content;
|
||||
std::string orientation;
|
||||
|
||||
if (m_flipMask)
|
||||
text += " Selection";
|
||||
content = Strings::commands_Flip_Selection();
|
||||
else
|
||||
text += " Canvas";
|
||||
content = Strings::commands_Flip_Canvas();
|
||||
|
||||
if (m_flipType == doc::algorithm::FlipHorizontal)
|
||||
text += " Horizontal";
|
||||
content = Strings::commands_Flip_Horizontally();
|
||||
else
|
||||
text += " Vertical";
|
||||
content = Strings::commands_Flip_Vertically();
|
||||
|
||||
return text;
|
||||
return fmt::format(getBaseFriendlyName(), content, orientation);
|
||||
}
|
||||
|
||||
Command* CommandFactory::createFlipCommand()
|
||||
|
@ -51,9 +51,7 @@ private:
|
||||
};
|
||||
|
||||
FramePropertiesCommand::FramePropertiesCommand()
|
||||
: Command("FrameProperties",
|
||||
"Frame Properties",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("FrameProperties", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -44,9 +44,7 @@ private:
|
||||
};
|
||||
|
||||
FrameTagPropertiesCommand::FrameTagPropertiesCommand()
|
||||
: Command("FrameTagProperties",
|
||||
"Frame Tag Properties",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("FrameTagProperties", CmdUIOnlyFlag)
|
||||
, m_tagId(NullId)
|
||||
{
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -264,9 +264,7 @@ protected:
|
||||
};
|
||||
|
||||
FullscreenPreviewCommand::FullscreenPreviewCommand()
|
||||
: Command("FullscreenPreview",
|
||||
"Fullscreen Preview",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("FullscreenPreview", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -30,8 +30,8 @@ using namespace doc;
|
||||
|
||||
class GotoCommand : public Command {
|
||||
protected:
|
||||
GotoCommand(const char* short_name, const char* friendly_name)
|
||||
: Command(short_name, friendly_name, CmdRecordableFlag) { }
|
||||
GotoCommand(const char* id)
|
||||
: Command(id, CmdRecordableFlag) { }
|
||||
|
||||
bool onEnabled(Context* context) override {
|
||||
return (current_editor != NULL);
|
||||
@ -49,8 +49,7 @@ protected:
|
||||
class GotoFirstFrameCommand : public GotoCommand {
|
||||
public:
|
||||
GotoFirstFrameCommand()
|
||||
: GotoCommand("GotoFirstFrame",
|
||||
"Go to First Frame") { }
|
||||
: GotoCommand("GotoFirstFrame") { }
|
||||
Command* clone() const override { return new GotoFirstFrameCommand(*this); }
|
||||
|
||||
protected:
|
||||
@ -62,8 +61,7 @@ protected:
|
||||
class GotoPreviousFrameCommand : public GotoCommand {
|
||||
public:
|
||||
GotoPreviousFrameCommand()
|
||||
: GotoCommand("GotoPreviousFrame",
|
||||
"Go to Previous Frame") { }
|
||||
: GotoCommand("GotoPreviousFrame") { }
|
||||
Command* clone() const override { return new GotoPreviousFrameCommand(*this); }
|
||||
|
||||
protected:
|
||||
@ -77,8 +75,7 @@ protected:
|
||||
|
||||
class GotoNextFrameCommand : public GotoCommand {
|
||||
public:
|
||||
GotoNextFrameCommand() : GotoCommand("GotoNextFrame",
|
||||
"Go to Next Frame") { }
|
||||
GotoNextFrameCommand() : GotoCommand("GotoNextFrame") { }
|
||||
Command* clone() const override { return new GotoNextFrameCommand(*this); }
|
||||
|
||||
protected:
|
||||
@ -92,8 +89,7 @@ protected:
|
||||
|
||||
class GotoNextFrameWithSameTagCommand : public GotoCommand {
|
||||
public:
|
||||
GotoNextFrameWithSameTagCommand() : GotoCommand("GotoNextFrameWithSameTag",
|
||||
"Go to Next Frame with same tag") { }
|
||||
GotoNextFrameWithSameTagCommand() : GotoCommand("GotoNextFrameWithSameTag") { }
|
||||
Command* clone() const override { return new GotoNextFrameWithSameTagCommand(*this); }
|
||||
|
||||
protected:
|
||||
@ -112,8 +108,7 @@ protected:
|
||||
|
||||
class GotoPreviousFrameWithSameTagCommand : public GotoCommand {
|
||||
public:
|
||||
GotoPreviousFrameWithSameTagCommand() : GotoCommand("GotoPreviousFrameWithSameTag",
|
||||
"Go to Previous Frame with same tag") { }
|
||||
GotoPreviousFrameWithSameTagCommand() : GotoCommand("GotoPreviousFrameWithSameTag") { }
|
||||
Command* clone() const override { return new GotoPreviousFrameWithSameTagCommand(*this); }
|
||||
|
||||
protected:
|
||||
@ -132,8 +127,7 @@ protected:
|
||||
|
||||
class GotoLastFrameCommand : public GotoCommand {
|
||||
public:
|
||||
GotoLastFrameCommand() : GotoCommand("GotoLastFrame",
|
||||
"Go to Last Frame") { }
|
||||
GotoLastFrameCommand() : GotoCommand("GotoLastFrame") { }
|
||||
Command* clone() const override { return new GotoLastFrameCommand(*this); }
|
||||
|
||||
protected:
|
||||
@ -144,8 +138,7 @@ protected:
|
||||
|
||||
class GotoFrameCommand : public GotoCommand {
|
||||
public:
|
||||
GotoFrameCommand() : GotoCommand("GotoFrame",
|
||||
"Go to Frame")
|
||||
GotoFrameCommand() : GotoCommand("GotoFrame")
|
||||
, m_showUI(true) { }
|
||||
Command* clone() const override { return new GotoFrameCommand(*this); }
|
||||
|
||||
|
@ -24,10 +24,9 @@ namespace app {
|
||||
class GotoLayerCommand : public Command {
|
||||
public:
|
||||
GotoLayerCommand(int offset,
|
||||
const char* shortName,
|
||||
const char* friendlyName,
|
||||
const char* id,
|
||||
CommandFlags flags)
|
||||
: Command(shortName, friendlyName, flags),
|
||||
: Command(id, flags),
|
||||
m_offset(offset) {
|
||||
}
|
||||
|
||||
@ -87,7 +86,6 @@ class GotoPreviousLayerCommand : public GotoLayerCommand {
|
||||
public:
|
||||
GotoPreviousLayerCommand()
|
||||
: GotoLayerCommand(-1, "GotoPreviousLayer",
|
||||
"Go to Previous Layer",
|
||||
CmdUIOnlyFlag) {
|
||||
}
|
||||
Command* clone() const override {
|
||||
@ -99,7 +97,6 @@ class GotoNextLayerCommand : public GotoLayerCommand {
|
||||
public:
|
||||
GotoNextLayerCommand()
|
||||
: GotoLayerCommand(+1, "GotoNextLayer",
|
||||
"Go to Next Layer",
|
||||
CmdUIOnlyFlag) {
|
||||
}
|
||||
Command* clone() const override {
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -26,9 +26,7 @@ protected:
|
||||
};
|
||||
|
||||
GotoNextTabCommand::GotoNextTabCommand()
|
||||
: Command("GotoNextTab",
|
||||
"Go to Next Tab",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("GotoNextTab", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
@ -53,9 +51,7 @@ protected:
|
||||
};
|
||||
|
||||
GotoPreviousTabCommand::GotoPreviousTabCommand()
|
||||
: Command("GotoPreviousTab",
|
||||
"Go to Previous tab",
|
||||
CmdRecordableFlag)
|
||||
: Command("GotoPreviousTab", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -31,9 +31,7 @@ using namespace gfx;
|
||||
class SnapToGridCommand : public Command {
|
||||
public:
|
||||
SnapToGridCommand()
|
||||
: Command("SnapToGrid",
|
||||
"Snap to Grid",
|
||||
CmdUIOnlyFlag) {
|
||||
: Command("SnapToGrid", CmdUIOnlyFlag) {
|
||||
}
|
||||
|
||||
Command* clone() const override { return new SnapToGridCommand(*this); }
|
||||
@ -56,9 +54,7 @@ protected:
|
||||
class SelectionAsGridCommand : public Command {
|
||||
public:
|
||||
SelectionAsGridCommand()
|
||||
: Command("SelectionAsGrid",
|
||||
"Selection as Grid",
|
||||
CmdUIOnlyFlag) {
|
||||
: Command("SelectionAsGrid", CmdUIOnlyFlag) {
|
||||
}
|
||||
|
||||
Command* clone() const override { return new SelectionAsGridCommand(*this); }
|
||||
@ -95,9 +91,7 @@ protected:
|
||||
};
|
||||
|
||||
GridSettingsCommand::GridSettingsCommand()
|
||||
: Command("GridSettings",
|
||||
"Grid Settings",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("GridSettings", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -27,9 +27,7 @@ protected:
|
||||
};
|
||||
|
||||
HomeCommand::HomeCommand()
|
||||
: Command("Home",
|
||||
"Home",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("Home", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -297,9 +297,7 @@ protected:
|
||||
};
|
||||
|
||||
ImportSpriteSheetCommand::ImportSpriteSheetCommand()
|
||||
: Command("ImportSpriteSheet",
|
||||
"Import Sprite Sheet",
|
||||
CmdRecordableFlag)
|
||||
: Command("ImportSpriteSheet", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015, 2017 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -33,9 +33,7 @@ protected:
|
||||
};
|
||||
|
||||
InvertMaskCommand::InvertMaskCommand()
|
||||
: Command("InvertMask",
|
||||
"Invert Mask",
|
||||
CmdRecordableFlag)
|
||||
: Command("InvertMask", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -749,9 +749,7 @@ private:
|
||||
};
|
||||
|
||||
KeyboardShortcutsCommand::KeyboardShortcutsCommand()
|
||||
: Command("KeyboardShortcuts",
|
||||
"Keyboard Shortcuts",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("KeyboardShortcuts", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -32,9 +32,7 @@ private:
|
||||
};
|
||||
|
||||
LaunchCommand::LaunchCommand()
|
||||
: Command("Launch",
|
||||
"Launch",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("Launch", CmdUIOnlyFlag)
|
||||
, m_type(Url)
|
||||
, m_path("")
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -30,9 +30,7 @@ protected:
|
||||
};
|
||||
|
||||
LayerFromBackgroundCommand::LayerFromBackgroundCommand()
|
||||
: Command("LayerFromBackground",
|
||||
"Layer From Background",
|
||||
CmdRecordableFlag)
|
||||
: Command("LayerFromBackground", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -32,9 +32,7 @@ protected:
|
||||
};
|
||||
|
||||
LayerLockCommand::LayerLockCommand()
|
||||
: Command("LayerLock",
|
||||
"Lock Layers",
|
||||
CmdRecordableFlag)
|
||||
: Command("LayerLock", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -14,11 +14,12 @@
|
||||
#include "app/commands/params.h"
|
||||
#include "app/context.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/transaction.h"
|
||||
#include "app/ui/timeline/timeline.h"
|
||||
#include "base/convert_to.h"
|
||||
#include "doc/layer.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
@ -40,9 +41,7 @@ private:
|
||||
};
|
||||
|
||||
LayerOpacityCommand::LayerOpacityCommand()
|
||||
: Command("LayerOpacity",
|
||||
"Layer Opacity",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("LayerOpacity", CmdUIOnlyFlag)
|
||||
{
|
||||
m_opacity = 255;
|
||||
}
|
||||
@ -95,12 +94,9 @@ void LayerOpacityCommand::onExecute(Context* context)
|
||||
|
||||
std::string LayerOpacityCommand::onGetFriendlyName() const
|
||||
{
|
||||
std::string text = "Set Layer Opacity to ";
|
||||
text += base::convert_to<std::string>(m_opacity);
|
||||
text += " (";
|
||||
text += base::convert_to<std::string>(int(100.0 * m_opacity / 255.0));
|
||||
text += "%)";
|
||||
return text;
|
||||
return fmt::format(getBaseFriendlyName(),
|
||||
m_opacity,
|
||||
int(100.0 * m_opacity / 255.0));
|
||||
}
|
||||
|
||||
Command* CommandFactory::createLayerOpacityCommand()
|
||||
|
@ -353,9 +353,7 @@ private:
|
||||
};
|
||||
|
||||
LayerPropertiesCommand::LayerPropertiesCommand()
|
||||
: Command("LayerProperties",
|
||||
"Layer Properties",
|
||||
CmdRecordableFlag)
|
||||
: Command("LayerProperties", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -32,9 +32,7 @@ protected:
|
||||
};
|
||||
|
||||
LayerVisibilityCommand::LayerVisibilityCommand()
|
||||
: Command("LayerVisibility",
|
||||
"Layer Visibility",
|
||||
CmdRecordableFlag)
|
||||
: Command("LayerVisibility", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -32,9 +32,7 @@ protected:
|
||||
};
|
||||
|
||||
LinkCelsCommand::LinkCelsCommand()
|
||||
: Command("LinkCels",
|
||||
"Links Cels",
|
||||
CmdRecordableFlag)
|
||||
: Command("LinkCels", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -38,9 +38,7 @@ protected:
|
||||
};
|
||||
|
||||
LoadMaskCommand::LoadMaskCommand()
|
||||
: Command("LoadMask",
|
||||
"Load Mask",
|
||||
CmdRecordableFlag)
|
||||
: Command("LoadMask", CmdRecordableFlag)
|
||||
{
|
||||
m_filename = "";
|
||||
}
|
||||
|
@ -41,9 +41,7 @@ private:
|
||||
};
|
||||
|
||||
LoadPaletteCommand::LoadPaletteCommand()
|
||||
: Command("LoadPalette",
|
||||
"Load Palette",
|
||||
CmdRecordableFlag)
|
||||
: Command("LoadPalette", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -29,9 +29,7 @@ protected:
|
||||
};
|
||||
|
||||
MaskAllCommand::MaskAllCommand()
|
||||
: Command("MaskAll",
|
||||
"Mask All",
|
||||
CmdRecordableFlag)
|
||||
: Command("MaskAll", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -63,9 +63,7 @@ private:
|
||||
};
|
||||
|
||||
MaskByColorCommand::MaskByColorCommand()
|
||||
: Command("MaskByColor",
|
||||
"Mask By Color",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("MaskByColor", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -40,9 +40,7 @@ protected:
|
||||
};
|
||||
|
||||
MaskContentCommand::MaskContentCommand()
|
||||
: Command("MaskContent",
|
||||
"Mask Content",
|
||||
CmdRecordableFlag)
|
||||
: Command("MaskContent", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -42,9 +42,7 @@ protected:
|
||||
};
|
||||
|
||||
MergeDownLayerCommand::MergeDownLayerCommand()
|
||||
: Command("MergeDownLayer",
|
||||
"Merge Down Layer",
|
||||
CmdRecordableFlag)
|
||||
: Command("MergeDownLayer", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2015, 2016 David Capello
|
||||
// Copyright (C) 2015-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -13,6 +13,7 @@
|
||||
#include "app/commands/params.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/document.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/pref/preferences.h"
|
||||
#include "app/transaction.h"
|
||||
@ -20,6 +21,7 @@
|
||||
#include "doc/brush_type.h"
|
||||
#include "doc/mask.h"
|
||||
#include "filters/neighboring_pixels.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
#include "modify_selection.xml.h"
|
||||
|
||||
@ -57,9 +59,7 @@ private:
|
||||
};
|
||||
|
||||
ModifySelectionCommand::ModifySelectionCommand()
|
||||
: Command("ModifySelection",
|
||||
"Modify Selection",
|
||||
CmdRecordableFlag)
|
||||
: Command("ModifySelection", CmdRecordableFlag)
|
||||
, m_modifier(Expand)
|
||||
, m_quantity(0)
|
||||
, m_brushType(doc::kCircleBrushType)
|
||||
@ -141,7 +141,7 @@ void ModifySelectionCommand::onExecute(Context* context)
|
||||
|
||||
// Set the new mask
|
||||
Transaction transaction(writer.context(),
|
||||
getActionName() + " Selection",
|
||||
friendlyName(),
|
||||
DoesntModifyDocument);
|
||||
transaction.execute(new cmd::SetMask(document, mask));
|
||||
transaction.commit();
|
||||
@ -152,29 +152,22 @@ void ModifySelectionCommand::onExecute(Context* context)
|
||||
|
||||
std::string ModifySelectionCommand::onGetFriendlyName() const
|
||||
{
|
||||
std::string text;
|
||||
std::string quantity;
|
||||
if (m_quantity > 0)
|
||||
quantity = fmt::format(Strings::commands_ModifySelection_Quantity(), m_quantity);
|
||||
|
||||
text += getActionName();
|
||||
text += " Selection";
|
||||
|
||||
if (m_quantity > 0) {
|
||||
text += " by ";
|
||||
text += base::convert_to<std::string>(m_quantity);
|
||||
text += " pixel";
|
||||
if (m_quantity > 1)
|
||||
text += "s";
|
||||
}
|
||||
|
||||
return text;
|
||||
return fmt::format(getBaseFriendlyName(),
|
||||
getActionName(),
|
||||
quantity);
|
||||
}
|
||||
|
||||
std::string ModifySelectionCommand::getActionName() const
|
||||
{
|
||||
switch (m_modifier) {
|
||||
case Border: return "Border";
|
||||
case Expand: return "Expand";
|
||||
case Contract: return "Contract";
|
||||
default: return "Modify";
|
||||
case Border: return Strings::commands_ModifySelection_Border();
|
||||
case Expand: return Strings::commands_ModifySelection_Expand();
|
||||
case Contract: return Strings::commands_ModifySelection_Contract();
|
||||
default: return Strings::commands_ModifySelection_Modify();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,9 +27,7 @@ protected:
|
||||
};
|
||||
|
||||
MoveCelCommand::MoveCelCommand()
|
||||
: Command("MoveCel",
|
||||
"Move Cel",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("MoveCel", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -15,6 +15,7 @@
|
||||
#include "app/commands/params.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/modules/editors.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/pref/preferences.h"
|
||||
@ -25,14 +26,13 @@
|
||||
#include "base/convert_to.h"
|
||||
#include "doc/mask.h"
|
||||
#include "doc/sprite.h"
|
||||
#include "fmt/format.h"
|
||||
#include "ui/view.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
MoveMaskCommand::MoveMaskCommand()
|
||||
: Command("MoveMask",
|
||||
"Move Mask",
|
||||
CmdRecordableFlag)
|
||||
: Command("MoveMask", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
@ -42,29 +42,12 @@ void MoveMaskCommand::onLoadParams(const Params& params)
|
||||
if (target == "boundaries") m_target = Boundaries;
|
||||
else if (target == "content") m_target = Content;
|
||||
|
||||
std::string direction = params.get("direction");
|
||||
if (direction == "left") m_direction = Left;
|
||||
else if (direction == "right") m_direction = Right;
|
||||
else if (direction == "up") m_direction = Up;
|
||||
else if (direction == "down") m_direction = Down;
|
||||
|
||||
std::string units = params.get("units");
|
||||
if (units == "pixel") m_units = Pixel;
|
||||
else if (units == "tile-width") m_units = TileWidth;
|
||||
else if (units == "tile-height") m_units = TileHeight;
|
||||
else if (units == "zoomed-pixel") m_units = ZoomedPixel;
|
||||
else if (units == "zoomed-tile-width") m_units = ZoomedTileWidth;
|
||||
else if (units == "zoomed-tile-height") m_units = ZoomedTileHeight;
|
||||
else if (units == "viewport-width") m_units = ViewportWidth;
|
||||
else if (units == "viewport-height") m_units = ViewportHeight;
|
||||
|
||||
int quantity = params.get_as<int>("quantity");
|
||||
m_quantity = std::max<int>(1, quantity);
|
||||
|
||||
if (params.has_param("wrap"))
|
||||
m_wrap = params.get_as<bool>("wrap");
|
||||
else
|
||||
m_wrap = false;
|
||||
|
||||
m_moveThing.onLoadParams(params);
|
||||
}
|
||||
|
||||
bool MoveMaskCommand::onEnabled(Context* context)
|
||||
@ -90,7 +73,7 @@ bool MoveMaskCommand::onEnabled(Context* context)
|
||||
|
||||
void MoveMaskCommand::onExecute(Context* context)
|
||||
{
|
||||
gfx::Point delta = getDelta(context);
|
||||
gfx::Point delta = m_moveThing.getDelta(context);
|
||||
|
||||
switch (m_target) {
|
||||
|
||||
@ -128,114 +111,15 @@ void MoveMaskCommand::onExecute(Context* context)
|
||||
}
|
||||
}
|
||||
|
||||
gfx::Point MoveMaskCommand::getDelta(Context* context) const
|
||||
{
|
||||
DocumentView* view = static_cast<UIContext*>(context)->activeView();
|
||||
if (!view)
|
||||
return gfx::Point(0, 0);
|
||||
|
||||
DocumentPreferences& docPref = Preferences::instance().document(view->document());
|
||||
Editor* editor = view->editor();
|
||||
gfx::Rect vp = view->viewWidget()->viewportBounds();
|
||||
gfx::Rect gridBounds = docPref.grid.bounds();
|
||||
int dx = 0;
|
||||
int dy = 0;
|
||||
int pixels = 0;
|
||||
|
||||
switch (m_units) {
|
||||
case Pixel:
|
||||
pixels = 1;
|
||||
break;
|
||||
case TileWidth:
|
||||
pixels = gridBounds.w;
|
||||
break;
|
||||
case TileHeight:
|
||||
pixels = gridBounds.h;
|
||||
break;
|
||||
case ZoomedPixel:
|
||||
pixels = editor->zoom().apply(1);
|
||||
break;
|
||||
case ZoomedTileWidth:
|
||||
pixels = editor->zoom().apply(gridBounds.w);
|
||||
break;
|
||||
case ZoomedTileHeight:
|
||||
pixels = editor->zoom().apply(gridBounds.h);
|
||||
break;
|
||||
case ViewportWidth:
|
||||
pixels = vp.h;
|
||||
break;
|
||||
case ViewportHeight:
|
||||
pixels = vp.w;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (m_direction) {
|
||||
case Left: dx = -m_quantity * pixels; break;
|
||||
case Right: dx = +m_quantity * pixels; break;
|
||||
case Up: dy = -m_quantity * pixels; break;
|
||||
case Down: dy = +m_quantity * pixels; break;
|
||||
}
|
||||
|
||||
return gfx::Point(dx, dy);
|
||||
}
|
||||
|
||||
std::string MoveMaskCommand::onGetFriendlyName() const
|
||||
{
|
||||
std::string text = "Move";
|
||||
|
||||
std::string content;
|
||||
switch (m_target) {
|
||||
|
||||
case Boundaries: {
|
||||
text += " Selection Boundaries";
|
||||
break;
|
||||
case Boundaries: content = Strings::commands_MoveMask_Boundaries(); break;
|
||||
case Content: content = Strings::commands_MoveMask_Content(); break;
|
||||
}
|
||||
|
||||
case Content: {
|
||||
text += " Selection Content";
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
text += " " + base::convert_to<std::string>(m_quantity);
|
||||
|
||||
switch (m_units) {
|
||||
case Pixel:
|
||||
text += " pixel";
|
||||
break;
|
||||
case TileWidth:
|
||||
text += " horizontal tile";
|
||||
break;
|
||||
case TileHeight:
|
||||
text += " vertical tile";
|
||||
break;
|
||||
case ZoomedPixel:
|
||||
text += " zoomed pixel";
|
||||
break;
|
||||
case ZoomedTileWidth:
|
||||
text += " zoomed horizontal tile";
|
||||
break;
|
||||
case ZoomedTileHeight:
|
||||
text += " zoomed vertical tile";
|
||||
break;
|
||||
case ViewportWidth:
|
||||
text += " viewport width";
|
||||
break;
|
||||
case ViewportHeight:
|
||||
text += " viewport height";
|
||||
break;
|
||||
}
|
||||
if (m_quantity != 1)
|
||||
text += "s";
|
||||
|
||||
switch (m_direction) {
|
||||
case Left: text += " left"; break;
|
||||
case Right: text += " right"; break;
|
||||
case Up: text += " up"; break;
|
||||
case Down: text += " down"; break;
|
||||
}
|
||||
|
||||
return text;
|
||||
return fmt::format(getBaseFriendlyName(),
|
||||
content, m_moveThing.getFriendlyString());
|
||||
}
|
||||
|
||||
Command* CommandFactory::createMoveMaskCommand()
|
||||
|
@ -9,23 +9,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "app/commands/command.h"
|
||||
#include "app/commands/move_thing.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
class MoveMaskCommand : public Command {
|
||||
public:
|
||||
enum Target { Boundaries, Content };
|
||||
enum Direction { Left, Up, Right, Down, }; // TODO join this enum with scroll command
|
||||
enum Units {
|
||||
Pixel,
|
||||
TileWidth,
|
||||
TileHeight,
|
||||
ZoomedPixel,
|
||||
ZoomedTileWidth,
|
||||
ZoomedTileHeight,
|
||||
ViewportWidth,
|
||||
ViewportHeight
|
||||
};
|
||||
|
||||
MoveMaskCommand();
|
||||
Command* clone() const override { return new MoveMaskCommand(*this); }
|
||||
@ -42,9 +32,7 @@ namespace app {
|
||||
|
||||
private:
|
||||
Target m_target;
|
||||
Direction m_direction;
|
||||
Units m_units;
|
||||
int m_quantity;
|
||||
MoveThing m_moveThing;
|
||||
bool m_wrap;
|
||||
};
|
||||
|
||||
|
@ -55,9 +55,7 @@ private:
|
||||
};
|
||||
|
||||
NewBrushCommand::NewBrushCommand()
|
||||
: Command("NewBrush",
|
||||
"New Brush",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("NewBrush", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -14,6 +14,7 @@
|
||||
#include "app/commands/command.h"
|
||||
#include "app/console.h"
|
||||
#include "app/document.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/modules/editors.h"
|
||||
#include "app/modules/palettes.h"
|
||||
#include "app/pref/preferences.h"
|
||||
@ -50,9 +51,7 @@ protected:
|
||||
static int _sprite_counter = 0;
|
||||
|
||||
NewFileCommand::NewFileCommand()
|
||||
: Command("NewFile",
|
||||
"New File",
|
||||
CmdRecordableFlag)
|
||||
: Command("NewFile", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "app/console.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/transaction.h"
|
||||
#include "app/ui/document_view.h"
|
||||
@ -27,6 +28,7 @@
|
||||
#include "doc/image.h"
|
||||
#include "doc/layer.h"
|
||||
#include "doc/sprite.h"
|
||||
#include "fmt/format.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
#include <stdexcept>
|
||||
@ -56,9 +58,7 @@ private:
|
||||
};
|
||||
|
||||
NewFrameCommand::NewFrameCommand()
|
||||
: Command("NewFrame",
|
||||
"New Frame",
|
||||
CmdRecordableFlag)
|
||||
: Command("NewFrame", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
@ -191,20 +191,20 @@ void NewFrameCommand::onExecute(Context* context)
|
||||
|
||||
std::string NewFrameCommand::onGetFriendlyName() const
|
||||
{
|
||||
std::string text = "New Frame";
|
||||
std::string text;
|
||||
|
||||
switch (m_content) {
|
||||
case Content::DUPLICATE_FRAME:
|
||||
text = "New Frame";
|
||||
text = Strings::commands_NewFrame();
|
||||
break;
|
||||
case Content::NEW_EMPTY_FRAME:
|
||||
text = "New Empty Frame";
|
||||
text = Strings::commands_NewFrame_NewEmptyFrame();
|
||||
break;
|
||||
case Content::DUPLICATE_CELS:
|
||||
text = "Duplicate Linked Cels";
|
||||
text = Strings::commands_NewFrame_DuplicateCels();
|
||||
break;
|
||||
case Content::DUPLICATE_CELS_BLOCK:
|
||||
text = "Duplicate Cels";
|
||||
text = Strings::commands_NewFrame_DuplicateCelsBlock();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -35,9 +35,7 @@ protected:
|
||||
};
|
||||
|
||||
NewFrameTagCommand::NewFrameTagCommand()
|
||||
: Command("NewFrameTag",
|
||||
"New Frame Tag",
|
||||
CmdRecordableFlag)
|
||||
: Command("NewFrameTag", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -65,9 +65,7 @@ private:
|
||||
};
|
||||
|
||||
NewLayerCommand::NewLayerCommand()
|
||||
: Command("NewLayer",
|
||||
"New Layer",
|
||||
CmdRecordableFlag)
|
||||
: Command("NewLayer", CmdRecordableFlag)
|
||||
{
|
||||
m_name = "";
|
||||
m_type = Type::Layer;
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -38,9 +38,7 @@ protected:
|
||||
};
|
||||
|
||||
NewSpriteFromSelectionCommand::NewSpriteFromSelectionCommand()
|
||||
: Command("NewSpriteFromSelection",
|
||||
"New Sprite From Selection",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("NewSpriteFromSelection", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -21,9 +21,7 @@ using namespace gfx;
|
||||
class ShowOnionSkinCommand : public Command {
|
||||
public:
|
||||
ShowOnionSkinCommand()
|
||||
: Command("ShowOnionSkin",
|
||||
"Show Onion Skin",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("ShowOnionSkin", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2016 David Capello
|
||||
// Copyright (C) 2016-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -30,9 +30,7 @@ private:
|
||||
};
|
||||
|
||||
OpenBrowserCommand::OpenBrowserCommand()
|
||||
: Command("OpenBrowser",
|
||||
"Open Browser",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("OpenBrowser", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -75,9 +75,7 @@ private:
|
||||
};
|
||||
|
||||
OpenFileCommand::OpenFileCommand()
|
||||
: Command("OpenFile",
|
||||
"Open Sprite",
|
||||
CmdRecordableFlag)
|
||||
: Command("OpenFile", CmdRecordableFlag)
|
||||
, m_repeatCheckbox(false)
|
||||
, m_oneFrame(false)
|
||||
, m_seqDecision(SequenceDecision::Ask)
|
||||
|
@ -33,9 +33,7 @@ protected:
|
||||
};
|
||||
|
||||
OpenGroupCommand::OpenGroupCommand()
|
||||
: Command("OpenGroup",
|
||||
"Open/Close Group",
|
||||
CmdRecordableFlag)
|
||||
: Command("OpenGroup", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -27,9 +27,7 @@ protected:
|
||||
};
|
||||
|
||||
OpenInFolderCommand::OpenInFolderCommand()
|
||||
: Command("OpenInFolder",
|
||||
"Open In Folder",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("OpenInFolder", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -27,9 +27,7 @@ protected:
|
||||
};
|
||||
|
||||
OpenWithAppCommand::OpenWithAppCommand()
|
||||
: Command("OpenWithApp",
|
||||
"Open With Associated Application",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("OpenWithApp", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1037,9 +1037,7 @@ protected:
|
||||
};
|
||||
|
||||
OptionsCommand::OptionsCommand()
|
||||
: Command("Options",
|
||||
"Options",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("Options", CmdUIOnlyFlag)
|
||||
{
|
||||
Preferences& preferences = Preferences::instance();
|
||||
|
||||
|
@ -10,7 +10,9 @@
|
||||
|
||||
#include "app/commands/command.h"
|
||||
#include "app/commands/params.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/ui/color_bar.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
@ -32,9 +34,7 @@ private:
|
||||
};
|
||||
|
||||
PaletteEditorCommand::PaletteEditorCommand()
|
||||
: Command("PaletteEditor",
|
||||
"Edit Palette",
|
||||
CmdRecordableFlag)
|
||||
: Command("PaletteEditor", CmdRecordableFlag)
|
||||
{
|
||||
m_edit = true;
|
||||
m_popup = false;
|
||||
@ -91,21 +91,20 @@ void PaletteEditorCommand::onExecute(Context* context)
|
||||
|
||||
std::string PaletteEditorCommand::onGetFriendlyName() const
|
||||
{
|
||||
std::string text = "Switch";
|
||||
std::string edit, plus, popup;
|
||||
if (m_edit) {
|
||||
text += " Edit Palette Mode";
|
||||
edit = Strings::commands_PaletteEditor_Edit();
|
||||
}
|
||||
if (m_edit && m_popup) {
|
||||
text += " and";
|
||||
plus = Strings::commands_PaletteEditor_And();
|
||||
}
|
||||
if (m_popup) {
|
||||
if (m_background)
|
||||
text += " Background";
|
||||
popup = Strings::commands_PaletteEditor_BgPopup();
|
||||
else
|
||||
text += " Foreground";
|
||||
text += " Color Popup";
|
||||
popup = Strings::commands_PaletteEditor_FgPopup();
|
||||
}
|
||||
return text;
|
||||
return fmt::format(getBaseFriendlyName(), edit, plus, popup);
|
||||
}
|
||||
|
||||
Command* CommandFactory::createPaletteEditorCommand()
|
||||
|
@ -37,9 +37,7 @@ private:
|
||||
};
|
||||
|
||||
PaletteSizeCommand::PaletteSizeCommand()
|
||||
: Command("PaletteSize",
|
||||
"Palette Size",
|
||||
CmdRecordableFlag)
|
||||
: Command("PaletteSize", CmdRecordableFlag)
|
||||
{
|
||||
m_size = 0;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -25,9 +25,7 @@ protected:
|
||||
};
|
||||
|
||||
PasteCommand::PasteCommand()
|
||||
: Command("Paste",
|
||||
"Paste",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("Paste", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -45,9 +45,7 @@ protected:
|
||||
};
|
||||
|
||||
PasteTextCommand::PasteTextCommand()
|
||||
: Command("PasteText",
|
||||
"Insert Text",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("PasteText", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -30,9 +30,7 @@ protected:
|
||||
};
|
||||
|
||||
PixelPerfectModeCommand::PixelPerfectModeCommand()
|
||||
: Command("PixelPerfectMode",
|
||||
"Switch Pixel Perfect Mode",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("PixelPerfectMode", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -30,9 +30,7 @@ protected:
|
||||
};
|
||||
|
||||
PlayAnimationCommand::PlayAnimationCommand()
|
||||
: Command("PlayAnimation",
|
||||
"Play Animation",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("PlayAnimation", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -33,9 +33,7 @@ protected:
|
||||
};
|
||||
|
||||
RefreshCommand::RefreshCommand()
|
||||
: Command("Refresh",
|
||||
"Refresh",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("Refresh", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -30,9 +30,7 @@ protected:
|
||||
};
|
||||
|
||||
RemoveFrameCommand::RemoveFrameCommand()
|
||||
: Command("RemoveFrame",
|
||||
"Remove Frame",
|
||||
CmdRecordableFlag)
|
||||
: Command("RemoveFrame", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -38,9 +38,7 @@ private:
|
||||
};
|
||||
|
||||
RemoveFrameTagCommand::RemoveFrameTagCommand()
|
||||
: Command("RemoveFrameTag",
|
||||
"Remove Frame Tag",
|
||||
CmdRecordableFlag)
|
||||
: Command("RemoveFrameTag", CmdRecordableFlag)
|
||||
, m_tagId(NullId)
|
||||
{
|
||||
}
|
||||
|
@ -34,9 +34,7 @@ protected:
|
||||
};
|
||||
|
||||
RemoveLayerCommand::RemoveLayerCommand()
|
||||
: Command("RemoveLayer",
|
||||
"Remove Layer",
|
||||
CmdRecordableFlag)
|
||||
: Command("RemoveLayer", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -41,9 +41,7 @@ private:
|
||||
};
|
||||
|
||||
RemoveSliceCommand::RemoveSliceCommand()
|
||||
: Command("RemoveSlice",
|
||||
"Remove Slice",
|
||||
CmdRecordableFlag)
|
||||
: Command("RemoveSlice", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -29,9 +29,7 @@ protected:
|
||||
};
|
||||
|
||||
RepeatLastExportCommand::RepeatLastExportCommand()
|
||||
: Command("RepeatLastExport",
|
||||
"Repeat Last Export",
|
||||
CmdRecordableFlag)
|
||||
: Command("RepeatLastExport", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -29,9 +29,7 @@ protected:
|
||||
};
|
||||
|
||||
ReselectMaskCommand::ReselectMaskCommand()
|
||||
: Command("ReselectMask",
|
||||
"Reselect Mask",
|
||||
CmdRecordableFlag)
|
||||
: Command("ReselectMask", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -28,9 +28,7 @@ protected:
|
||||
};
|
||||
|
||||
ReverseFramesCommand::ReverseFramesCommand()
|
||||
: Command("ReverseFrames",
|
||||
"Reverse Frames",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("ReverseFrames", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "app/context_access.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/document_range.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/modules/editors.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/sprite_job.h"
|
||||
@ -31,6 +32,7 @@
|
||||
#include "doc/image.h"
|
||||
#include "doc/mask.h"
|
||||
#include "doc/sprite.h"
|
||||
#include "fmt/format.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
namespace app {
|
||||
@ -165,9 +167,7 @@ protected:
|
||||
};
|
||||
|
||||
RotateCommand::RotateCommand()
|
||||
: Command("Rotate",
|
||||
"Rotate Canvas",
|
||||
CmdRecordableFlag)
|
||||
: Command("Rotate", CmdRecordableFlag)
|
||||
{
|
||||
m_flipMask = false;
|
||||
m_angle = 0;
|
||||
@ -241,16 +241,13 @@ void RotateCommand::onExecute(Context* context)
|
||||
|
||||
std::string RotateCommand::onGetFriendlyName() const
|
||||
{
|
||||
std::string text = "Rotate";
|
||||
|
||||
std::string content;
|
||||
if (m_flipMask)
|
||||
text += " Selection";
|
||||
content = Strings::commands_Rotate_Selection();
|
||||
else
|
||||
text += " Sprite";
|
||||
|
||||
text += " " + base::convert_to<std::string>(m_angle) + "\xc2\xb0";
|
||||
|
||||
return text;
|
||||
content = Strings::commands_Rotate_Sprite();
|
||||
return fmt::format(getBaseFriendlyName(),
|
||||
content, base::convert_to<std::string>(m_angle));
|
||||
}
|
||||
|
||||
Command* CommandFactory::createRotateCommand()
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -21,6 +21,7 @@ namespace app {
|
||||
int angle() const { return m_angle; }
|
||||
|
||||
protected:
|
||||
bool onNeedsParams() const override { return true; }
|
||||
void onLoadParams(const Params& params) override;
|
||||
bool onEnabled(Context* context) override;
|
||||
void onExecute(Context* context) override;
|
||||
|
@ -49,9 +49,7 @@ private:
|
||||
};
|
||||
|
||||
RunScriptCommand::RunScriptCommand()
|
||||
: Command("RunScript",
|
||||
"Run Script",
|
||||
CmdRecordableFlag)
|
||||
: Command("RunScript", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -141,8 +141,8 @@ private:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
SaveFileBaseCommand::SaveFileBaseCommand(const char* short_name, const char* friendly_name, CommandFlags flags)
|
||||
: Command(short_name, friendly_name, flags)
|
||||
SaveFileBaseCommand::SaveFileBaseCommand(const char* id, CommandFlags flags)
|
||||
: Command(id, flags)
|
||||
{
|
||||
}
|
||||
|
||||
@ -357,7 +357,7 @@ protected:
|
||||
};
|
||||
|
||||
SaveFileCommand::SaveFileCommand()
|
||||
: SaveFileBaseCommand("SaveFile", "Save File", CmdRecordableFlag)
|
||||
: SaveFileBaseCommand("SaveFile", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
@ -393,7 +393,7 @@ protected:
|
||||
};
|
||||
|
||||
SaveFileAsCommand::SaveFileAsCommand()
|
||||
: SaveFileBaseCommand("SaveFileAs", "Save File As", CmdRecordableFlag)
|
||||
: SaveFileBaseCommand("SaveFileAs", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
@ -412,7 +412,7 @@ protected:
|
||||
};
|
||||
|
||||
SaveFileCopyAsCommand::SaveFileCopyAsCommand()
|
||||
: SaveFileBaseCommand("SaveFileCopyAs", "Export", CmdRecordableFlag)
|
||||
: SaveFileBaseCommand("SaveFileCopyAs", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ namespace app {
|
||||
|
||||
class SaveFileBaseCommand : public Command {
|
||||
public:
|
||||
SaveFileBaseCommand(const char* shortName, const char* friendlyName, CommandFlags flags);
|
||||
SaveFileBaseCommand(const char* id, CommandFlags flags);
|
||||
|
||||
std::string selectedFilename() const {
|
||||
return m_selectedFilename;
|
||||
|
@ -32,9 +32,7 @@ protected:
|
||||
};
|
||||
|
||||
SaveMaskCommand::SaveMaskCommand()
|
||||
: Command("SaveMask",
|
||||
"Save Mask",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("SaveMask", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -39,9 +39,7 @@ private:
|
||||
};
|
||||
|
||||
SavePaletteCommand::SavePaletteCommand()
|
||||
: Command("SavePalette",
|
||||
"Save Palette",
|
||||
CmdRecordableFlag)
|
||||
: Command("SavePalette", CmdRecordableFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -10,30 +10,20 @@
|
||||
|
||||
#include "app/app.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/commands/move_thing.h"
|
||||
#include "app/commands/params.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/modules/editors.h"
|
||||
#include "app/pref/preferences.h"
|
||||
#include "app/ui/editor/editor.h"
|
||||
#include "base/convert_to.h"
|
||||
#include "fmt/format.h"
|
||||
#include "ui/view.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
class ScrollCommand : public Command {
|
||||
public:
|
||||
enum Direction { Left, Up, Right, Down, };
|
||||
enum Units {
|
||||
Pixel,
|
||||
TileWidth,
|
||||
TileHeight,
|
||||
ZoomedPixel,
|
||||
ZoomedTileWidth,
|
||||
ZoomedTileHeight,
|
||||
ViewportWidth,
|
||||
ViewportHeight
|
||||
};
|
||||
|
||||
ScrollCommand();
|
||||
Command* clone() const override { return new ScrollCommand(*this); }
|
||||
|
||||
@ -45,38 +35,17 @@ protected:
|
||||
std::string onGetFriendlyName() const override;
|
||||
|
||||
private:
|
||||
Direction m_direction;
|
||||
Units m_units;
|
||||
int m_quantity;
|
||||
MoveThing m_moveThing;
|
||||
};
|
||||
|
||||
ScrollCommand::ScrollCommand()
|
||||
: Command("Scroll",
|
||||
"Scroll",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("Scroll", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
void ScrollCommand::onLoadParams(const Params& params)
|
||||
{
|
||||
std::string direction = params.get("direction");
|
||||
if (direction == "left") m_direction = Left;
|
||||
else if (direction == "right") m_direction = Right;
|
||||
else if (direction == "up") m_direction = Up;
|
||||
else if (direction == "down") m_direction = Down;
|
||||
|
||||
std::string units = params.get("units");
|
||||
if (units == "pixel") m_units = Pixel;
|
||||
else if (units == "tile-width") m_units = TileWidth;
|
||||
else if (units == "tile-height") m_units = TileHeight;
|
||||
else if (units == "zoomed-pixel") m_units = ZoomedPixel;
|
||||
else if (units == "zoomed-tile-width") m_units = ZoomedTileWidth;
|
||||
else if (units == "zoomed-tile-height") m_units = ZoomedTileHeight;
|
||||
else if (units == "viewport-width") m_units = ViewportWidth;
|
||||
else if (units == "viewport-height") m_units = ViewportHeight;
|
||||
|
||||
int quantity = params.get_as<int>("quantity");
|
||||
m_quantity = std::max<int>(1, quantity);
|
||||
m_moveThing.onLoadParams(params);
|
||||
}
|
||||
|
||||
bool ScrollCommand::onEnabled(Context* context)
|
||||
@ -87,92 +56,17 @@ bool ScrollCommand::onEnabled(Context* context)
|
||||
|
||||
void ScrollCommand::onExecute(Context* context)
|
||||
{
|
||||
DocumentPreferences& docPref = Preferences::instance().document(context->activeDocument());
|
||||
ui::View* view = ui::View::getView(current_editor);
|
||||
gfx::Rect vp = view->viewportBounds();
|
||||
gfx::Point scroll = view->viewScroll();
|
||||
gfx::Rect gridBounds = docPref.grid.bounds();
|
||||
gfx::Point delta(0, 0);
|
||||
int pixels = 0;
|
||||
|
||||
switch (m_units) {
|
||||
case Pixel:
|
||||
pixels = 1;
|
||||
break;
|
||||
case TileWidth:
|
||||
pixels = gridBounds.w;
|
||||
break;
|
||||
case TileHeight:
|
||||
pixels = gridBounds.h;
|
||||
break;
|
||||
case ZoomedPixel:
|
||||
pixels = current_editor->zoom().apply(1);
|
||||
break;
|
||||
case ZoomedTileWidth:
|
||||
pixels = current_editor->zoom().apply(gridBounds.w);
|
||||
break;
|
||||
case ZoomedTileHeight:
|
||||
pixels = current_editor->zoom().apply(gridBounds.h);
|
||||
break;
|
||||
case ViewportWidth:
|
||||
pixels = vp.h;
|
||||
break;
|
||||
case ViewportHeight:
|
||||
pixels = vp.w;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (m_direction) {
|
||||
case Left: delta.x = -m_quantity * pixels; break;
|
||||
case Right: delta.x = +m_quantity * pixels; break;
|
||||
case Up: delta.y = -m_quantity * pixels; break;
|
||||
case Down: delta.y = +m_quantity * pixels; break;
|
||||
}
|
||||
gfx::Point delta = m_moveThing.getDelta(context);
|
||||
|
||||
current_editor->setEditorScroll(scroll+delta);
|
||||
}
|
||||
|
||||
std::string ScrollCommand::onGetFriendlyName() const
|
||||
{
|
||||
std::string text = "Scroll " + base::convert_to<std::string>(m_quantity);
|
||||
|
||||
switch (m_units) {
|
||||
case Pixel:
|
||||
text += " pixel";
|
||||
break;
|
||||
case TileWidth:
|
||||
text += " horizontal tile";
|
||||
break;
|
||||
case TileHeight:
|
||||
text += " vertical tile";
|
||||
break;
|
||||
case ZoomedPixel:
|
||||
text += " zoomed pixel";
|
||||
break;
|
||||
case ZoomedTileWidth:
|
||||
text += " zoomed horizontal tile";
|
||||
break;
|
||||
case ZoomedTileHeight:
|
||||
text += " zoomed vertical tile";
|
||||
break;
|
||||
case ViewportWidth:
|
||||
text += " viewport width";
|
||||
break;
|
||||
case ViewportHeight:
|
||||
text += " viewport height";
|
||||
break;
|
||||
}
|
||||
if (m_quantity != 1)
|
||||
text += "s";
|
||||
|
||||
switch (m_direction) {
|
||||
case Left: text += " left"; break;
|
||||
case Right: text += " right"; break;
|
||||
case Up: text += " up"; break;
|
||||
case Down: text += " down"; break;
|
||||
}
|
||||
|
||||
return text;
|
||||
return fmt::format(getBaseFriendlyName(),
|
||||
m_moveThing.getFriendlyString());
|
||||
}
|
||||
|
||||
Command* CommandFactory::createScrollCommand()
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -27,9 +27,7 @@ protected:
|
||||
};
|
||||
|
||||
ScrollCenterCommand::ScrollCenterCommand()
|
||||
: Command("ScrollCenter",
|
||||
"Scroll to center of canvas",
|
||||
CmdUIOnlyFlag)
|
||||
: Command("ScrollCenter", CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "app/commands/command.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/document.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/modules/editors.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/pref/preferences.h"
|
||||
@ -19,6 +20,7 @@
|
||||
#include "app/transaction.h"
|
||||
#include "app/ui/editor/editor.h"
|
||||
#include "doc/mask.h"
|
||||
#include "fmt/format.h"
|
||||
#include "ui/system.h"
|
||||
|
||||
namespace app {
|
||||
@ -41,9 +43,7 @@ private:
|
||||
};
|
||||
|
||||
SelectTileCommand::SelectTileCommand()
|
||||
: Command("SelectTile",
|
||||
"Select Tile",
|
||||
CmdRecordableFlag)
|
||||
: Command("SelectTile", CmdRecordableFlag)
|
||||
, m_mode(gen::SelectionMode::DEFAULT)
|
||||
{
|
||||
}
|
||||
@ -94,7 +94,7 @@ void SelectTileCommand::onExecute(Context* ctx)
|
||||
|
||||
// Set the new mask
|
||||
Transaction transaction(writer.context(),
|
||||
"Select Tile",
|
||||
friendlyName(),
|
||||
DoesntModifyDocument);
|
||||
transaction.execute(new cmd::SetMask(doc, mask));
|
||||
transaction.commit();
|
||||
@ -105,13 +105,18 @@ void SelectTileCommand::onExecute(Context* ctx)
|
||||
|
||||
std::string SelectTileCommand::onGetFriendlyName() const
|
||||
{
|
||||
std::string text = "Select Tile";
|
||||
|
||||
std::string text;
|
||||
switch (m_mode) {
|
||||
case gen::SelectionMode::ADD: text += " (Add)"; break;
|
||||
case gen::SelectionMode::SUBTRACT: text += " (Subtract)"; break;
|
||||
case gen::SelectionMode::ADD:
|
||||
text = Strings::commands_SelectTile_Add();
|
||||
break;
|
||||
case gen::SelectionMode::SUBTRACT:
|
||||
text = Strings::commands_SelectTile_Subtract();
|
||||
break;
|
||||
default:
|
||||
text = getBaseFriendlyName();;
|
||||
break;
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user