mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-16 23:42:57 +00:00
Refactor several "getNoun()" getters to "noun()"
This is a work-in-progress to create a consistent API and finally separate the whole Aseprite base/gfx/ui libs into a reusable C++ library. Classes: app::IFileItem, app::AppMenuItem, app::skin::SkinPart, gfx::Rect, gfx::Border, she::FileDialog, ui::IButtonIcon, ui::Graphics, ui::Overlay, ui::Widget, ui::ScrollableViewDelegate, and UI events
This commit is contained in:
parent
98f026731e
commit
1aaeacc460
@ -19,7 +19,7 @@ namespace cmd {
|
||||
|
||||
SetMaskPosition::SetMaskPosition(Document* doc, const gfx::Point& pos)
|
||||
: WithDocument(doc)
|
||||
, m_oldPosition(doc->mask()->bounds().getOrigin())
|
||||
, m_oldPosition(doc->mask()->bounds().origin())
|
||||
, m_newPosition(pos)
|
||||
{
|
||||
}
|
||||
|
@ -82,12 +82,12 @@ public:
|
||||
|
||||
bool pressedOk() { return getKiller() == ok(); }
|
||||
|
||||
int getWidth() { return width()->getTextInt(); }
|
||||
int getHeight() { return height()->getTextInt(); }
|
||||
int getLeft() { return left()->getTextInt(); }
|
||||
int getRight() { return right()->getTextInt(); }
|
||||
int getTop() { return top()->getTextInt(); }
|
||||
int getBottom() { return bottom()->getTextInt(); }
|
||||
int getWidth() { return width()->textInt(); }
|
||||
int getHeight() { return height()->textInt(); }
|
||||
int getLeft() { return left()->textInt(); }
|
||||
int getRight() { return right()->textInt(); }
|
||||
int getTop() { return top()->textInt(); }
|
||||
int getBottom() { return bottom()->textInt(); }
|
||||
|
||||
protected:
|
||||
|
||||
@ -214,7 +214,7 @@ private:
|
||||
}
|
||||
|
||||
void updateIcons() {
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
|
||||
int sel = dir()->selectedItem();
|
||||
|
||||
|
@ -110,7 +110,7 @@ void ColorQuantizationCommand::onExecute(Context* context)
|
||||
if (entries.picks() > 1) {
|
||||
window.currentRange()->setTextf(
|
||||
"%s, %d color(s)",
|
||||
window.currentRange()->getText().c_str(),
|
||||
window.currentRange()->text().c_str(),
|
||||
entries.picks());
|
||||
}
|
||||
else
|
||||
@ -118,7 +118,7 @@ void ColorQuantizationCommand::onExecute(Context* context)
|
||||
|
||||
window.currentPalette()->setTextf(
|
||||
"%s, %d color(s)",
|
||||
window.currentPalette()->getText().c_str(),
|
||||
window.currentPalette()->text().c_str(),
|
||||
curPalette->size());
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ void ColorQuantizationCommand::onExecute(Context* context)
|
||||
|
||||
bool createPal = false;
|
||||
if (window.newPalette()->isSelected()) {
|
||||
int n = window.ncolors()->getTextInt();
|
||||
int n = window.ncolors()->textInt();
|
||||
n = MAX(1, n);
|
||||
entries = PalettePicks(n);
|
||||
entries.all();
|
||||
|
@ -78,7 +78,7 @@ void DuplicateSpriteCommand::onExecute(Context* context)
|
||||
else
|
||||
docCopy = document->duplicate(DuplicateExactCopy);
|
||||
|
||||
docCopy->setFilename(window.dstName()->getText().c_str());
|
||||
docCopy->setFilename(window.dstName()->text().c_str());
|
||||
docCopy->setContext(context);
|
||||
}
|
||||
}
|
||||
|
@ -411,24 +411,24 @@ public:
|
||||
|
||||
int columnsValue() const {
|
||||
if (spriteSheetTypeValue() != SpriteSheetType::Columns)
|
||||
return columns()->getTextInt();
|
||||
return columns()->textInt();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rowsValue() const {
|
||||
if (spriteSheetTypeValue() == SpriteSheetType::Columns)
|
||||
return rows()->getTextInt();
|
||||
return rows()->textInt();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fitWidthValue() const {
|
||||
return fitWidth()->getEntryWidget()->getTextInt();
|
||||
return fitWidth()->getEntryWidget()->textInt();
|
||||
}
|
||||
|
||||
int fitHeightValue() const {
|
||||
return fitHeight()->getEntryWidget()->getTextInt();
|
||||
return fitHeight()->getEntryWidget()->textInt();
|
||||
}
|
||||
|
||||
bool bestFitValue() const {
|
||||
@ -451,7 +451,7 @@ public:
|
||||
|
||||
int borderPaddingValue() const {
|
||||
if (paddingEnabled()->isSelected()) {
|
||||
int value = borderPadding()->getTextInt();
|
||||
int value = borderPadding()->textInt();
|
||||
return MID(0, value, 100);
|
||||
}
|
||||
else
|
||||
@ -460,7 +460,7 @@ public:
|
||||
|
||||
int shapePaddingValue() const {
|
||||
if (paddingEnabled()->isSelected()) {
|
||||
int value = shapePadding()->getTextInt();
|
||||
int value = shapePadding()->textInt();
|
||||
return MID(0, value, 100);
|
||||
}
|
||||
else
|
||||
@ -469,7 +469,7 @@ public:
|
||||
|
||||
int innerPaddingValue() const {
|
||||
if (paddingEnabled()->isSelected()) {
|
||||
int value = innerPadding()->getTextInt();
|
||||
int value = innerPadding()->textInt();
|
||||
return MID(0, value, 100);
|
||||
}
|
||||
else
|
||||
@ -634,7 +634,7 @@ private:
|
||||
|
||||
void resize() {
|
||||
gfx::Size reqSize = sizeHint();
|
||||
moveWindow(gfx::Rect(getOrigin(), reqSize));
|
||||
moveWindow(gfx::Rect(origin(), reqSize));
|
||||
layout();
|
||||
invalidate();
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ void FramePropertiesCommand::onExecute(Context* context)
|
||||
|
||||
window.openWindowInForeground();
|
||||
if (window.getKiller() == window.ok()) {
|
||||
int num = window.frlen()->getTextInt();
|
||||
int num = window.frlen()->textInt();
|
||||
|
||||
ContextWriter writer(reader);
|
||||
Transaction transaction(writer.context(), "Frame Duration");
|
||||
|
@ -63,13 +63,13 @@ public:
|
||||
m_tiled = (filters::TiledMode)docPref.tiled.mode();
|
||||
|
||||
// Free mouse
|
||||
editor->getManager()->freeMouse();
|
||||
editor->manager()->freeMouse();
|
||||
|
||||
// Clear extras (e.g. pen preview)
|
||||
m_doc->setExtraCel(ExtraCelRef(nullptr));
|
||||
|
||||
gfx::Rect vp = view->getViewportBounds();
|
||||
gfx::Point scroll = view->getViewScroll();
|
||||
gfx::Rect vp = view->viewportBounds();
|
||||
gfx::Point scroll = view->viewScroll();
|
||||
|
||||
m_oldMousePos = ui::get_mouse_position();
|
||||
m_pos.x = -scroll.x + vp.x + editor->padding().x;
|
||||
@ -91,7 +91,7 @@ protected:
|
||||
MouseMessage* mouseMsg = static_cast<MouseMessage*>(msg);
|
||||
gfx::Point mousePos = mouseMsg->position();
|
||||
|
||||
gfx::Rect bounds = getBounds();
|
||||
gfx::Rect bounds = this->bounds();
|
||||
gfx::Border border;
|
||||
if (bounds.w > 64*guiscale()) {
|
||||
border.left(32*guiscale());
|
||||
@ -172,7 +172,7 @@ protected:
|
||||
}
|
||||
|
||||
virtual void onPaint(PaintEvent& ev) override {
|
||||
Graphics* g = ev.getGraphics();
|
||||
Graphics* g = ev.graphics();
|
||||
AppRender& render = m_editor->renderEngine();
|
||||
render.disableOnionskin();
|
||||
render.setBgType(render::BgType::TRANSPARENT);
|
||||
|
@ -125,7 +125,7 @@ protected:
|
||||
if (window.getKiller() != window.ok())
|
||||
return editor->frame();
|
||||
|
||||
m_frame = window.frame()->getTextInt();
|
||||
m_frame = window.frame()->textInt();
|
||||
}
|
||||
|
||||
return MID(0, m_frame-1, editor->sprite()->lastFrame());
|
||||
|
@ -169,10 +169,10 @@ void GridSettingsCommand::onExecute(Context* context)
|
||||
window->openWindowInForeground();
|
||||
|
||||
if (window->getKiller() == button_ok) {
|
||||
bounds.x = grid_x->getTextInt();
|
||||
bounds.y = grid_y->getTextInt();
|
||||
bounds.w = grid_w->getTextInt();
|
||||
bounds.h = grid_h->getTextInt();
|
||||
bounds.x = grid_x->textInt();
|
||||
bounds.y = grid_y->textInt();
|
||||
bounds.w = grid_w->textInt();
|
||||
bounds.h = grid_h->textInt();
|
||||
bounds.w = MAX(bounds.w, 1);
|
||||
bounds.h = MAX(bounds.h, 1);
|
||||
|
||||
|
@ -130,12 +130,12 @@ protected:
|
||||
}
|
||||
|
||||
gfx::Rect getRectFromEntries() {
|
||||
int w = width()->getTextInt();
|
||||
int h = height()->getTextInt();
|
||||
int w = width()->textInt();
|
||||
int h = height()->textInt();
|
||||
|
||||
return gfx::Rect(
|
||||
x()->getTextInt(),
|
||||
y()->getTextInt(),
|
||||
x()->textInt(),
|
||||
y()->textInt(),
|
||||
std::max<int>(1, w),
|
||||
std::max<int>(1, h));
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ private:
|
||||
m_key->add(window.accel(), KeySource::UserDefined);
|
||||
}
|
||||
|
||||
getRoot()->layout();
|
||||
this->window()->layout();
|
||||
}
|
||||
|
||||
void onDeleteAccel(int index)
|
||||
@ -94,7 +94,7 @@ private:
|
||||
return;
|
||||
|
||||
m_key->disableAccel(m_key->accels()[index]);
|
||||
getRoot()->layout();
|
||||
window()->layout();
|
||||
}
|
||||
|
||||
void onAddAccel() {
|
||||
@ -118,11 +118,11 @@ private:
|
||||
m_key->add(window.accel(), KeySource::UserDefined);
|
||||
}
|
||||
|
||||
getRoot()->layout();
|
||||
this->window()->layout();
|
||||
}
|
||||
|
||||
void onSizeHint(SizeHintEvent& ev) override {
|
||||
gfx::Size size = getTextSize();
|
||||
gfx::Size size = textSize();
|
||||
size.w = size.w + border().width();
|
||||
size.h = size.h + border().height() + 4*guiscale();
|
||||
|
||||
@ -136,9 +136,9 @@ private:
|
||||
}
|
||||
|
||||
void onPaint(PaintEvent& ev) override {
|
||||
Graphics* g = ev.getGraphics();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
gfx::Rect bounds = getClientBounds();
|
||||
Graphics* g = ev.graphics();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
gfx::Rect bounds = clientBounds();
|
||||
gfx::Color fg, bg;
|
||||
|
||||
if (isSelected()) {
|
||||
@ -153,7 +153,7 @@ private:
|
||||
g->fillRect(bg, bounds);
|
||||
|
||||
bounds.shrink(border());
|
||||
g->drawUIString(getText(), fg, bg,
|
||||
g->drawUIString(text(), fg, bg,
|
||||
gfx::Point(
|
||||
bounds.x + m_level*16 * guiscale(),
|
||||
bounds.y + 2*guiscale()));
|
||||
@ -161,7 +161,7 @@ private:
|
||||
if (m_key && !m_key->accels().empty()) {
|
||||
std::string buf;
|
||||
int y = bounds.y;
|
||||
int dh = getTextSize().h + 4*guiscale();
|
||||
int dh = textSize().h + 4*guiscale();
|
||||
int i = 0;
|
||||
|
||||
for (const Accelerator& accel : m_key->accels()) {
|
||||
@ -191,18 +191,18 @@ private:
|
||||
}
|
||||
|
||||
case kMouseMoveMessage: {
|
||||
gfx::Rect bounds = getBounds();
|
||||
gfx::Rect bounds = this->bounds();
|
||||
MouseMessage* mouseMsg = static_cast<MouseMessage*>(msg);
|
||||
|
||||
const Accelerators* accels = (m_key ? &m_key->accels() : NULL);
|
||||
int y = bounds.y;
|
||||
int dh = getTextSize().h + 4*guiscale();
|
||||
int dh = textSize().h + 4*guiscale();
|
||||
int maxi = (accels && accels->size() > 1 ? accels->size(): 1);
|
||||
|
||||
for (int i=0; i<maxi; ++i, y += dh) {
|
||||
int w = Graphics::measureUIStringLength(
|
||||
(accels && i < (int)accels->size() ? (*accels)[i].toString().c_str(): ""),
|
||||
getFont());
|
||||
font());
|
||||
gfx::Rect itemBounds(bounds.x + g_sep, y, w, dh);
|
||||
itemBounds = itemBounds.enlarge(
|
||||
gfx::Border(
|
||||
@ -236,7 +236,7 @@ private:
|
||||
itemBounds.x + itemBounds.w + 2*guiscale(),
|
||||
itemBounds.y,
|
||||
Graphics::measureUIStringLength(
|
||||
label, getFont()) + 4*guiscale(),
|
||||
label, font()) + 4*guiscale(),
|
||||
itemBounds.h));
|
||||
m_deleteButton->setText(label);
|
||||
|
||||
@ -251,7 +251,7 @@ private:
|
||||
setup_mini_look(m_addButton.get());
|
||||
addChild(m_addButton.get());
|
||||
|
||||
itemBounds.w = 8*guiscale() + Graphics::measureUIStringLength("Add", getFont());
|
||||
itemBounds.w = 8*guiscale() + Graphics::measureUIStringLength("Add", font());
|
||||
itemBounds.x -= itemBounds.w + 2*guiscale();
|
||||
|
||||
m_addButton->setBgColor(gfx::ColorNone);
|
||||
@ -312,16 +312,16 @@ public:
|
||||
|
||||
private:
|
||||
void deleteAllKeyItems() {
|
||||
while (searchList()->getLastChild())
|
||||
searchList()->removeChild(searchList()->getLastChild());
|
||||
while (menus()->getLastChild())
|
||||
menus()->removeChild(menus()->getLastChild());
|
||||
while (commands()->getLastChild())
|
||||
commands()->removeChild(commands()->getLastChild());
|
||||
while (tools()->getLastChild())
|
||||
tools()->removeChild(tools()->getLastChild());
|
||||
while (actions()->getLastChild())
|
||||
actions()->removeChild(actions()->getLastChild());
|
||||
while (searchList()->lastChild())
|
||||
searchList()->removeChild(searchList()->lastChild());
|
||||
while (menus()->lastChild())
|
||||
menus()->removeChild(menus()->lastChild());
|
||||
while (commands()->lastChild())
|
||||
commands()->removeChild(commands()->lastChild());
|
||||
while (tools()->lastChild())
|
||||
tools()->removeChild(tools()->lastChild());
|
||||
while (actions()->lastChild())
|
||||
actions()->removeChild(actions()->lastChild());
|
||||
|
||||
for (KeyItem* keyItem : m_allKeyItems) {
|
||||
delete keyItem;
|
||||
@ -389,8 +389,8 @@ private:
|
||||
}
|
||||
|
||||
void fillSearchList(const std::string& search) {
|
||||
while (searchList()->getLastChild())
|
||||
searchList()->removeChild(searchList()->getLastChild());
|
||||
while (searchList()->lastChild())
|
||||
searchList()->removeChild(searchList()->lastChild());
|
||||
|
||||
std::vector<std::string> parts;
|
||||
base::split_string(base::string_to_lower(search), parts, " ");
|
||||
@ -403,7 +403,7 @@ private:
|
||||
for (auto item : listBox->children()) {
|
||||
if (KeyItem* keyItem = dynamic_cast<KeyItem*>(item)) {
|
||||
std::string itemText =
|
||||
base::string_to_lower(keyItem->getText());
|
||||
base::string_to_lower(keyItem->text());
|
||||
int matches = 0;
|
||||
|
||||
for (const auto& part : parts) {
|
||||
@ -414,14 +414,14 @@ private:
|
||||
if (matches == int(parts.size())) {
|
||||
if (!group) {
|
||||
group = new Separator(
|
||||
section()->children()[sectionIdx]->getText(), HORIZONTAL);
|
||||
section()->children()[sectionIdx]->text(), HORIZONTAL);
|
||||
group->setBgColor(SkinTheme::instance()->colors.background());
|
||||
|
||||
searchList()->addChild(group);
|
||||
}
|
||||
|
||||
KeyItem* copyItem =
|
||||
new KeyItem(keyItem->getText(),
|
||||
new KeyItem(keyItem->text(),
|
||||
keyItem->key(), nullptr, 0);
|
||||
searchList()->addChild(copyItem);
|
||||
}
|
||||
@ -434,7 +434,7 @@ private:
|
||||
|
||||
void onSearchChange() {
|
||||
base::ScopedValue<bool> flag(m_searchChange, true, false);
|
||||
std::string searchText = search()->getText();
|
||||
std::string searchText = search()->text();
|
||||
|
||||
if (searchText.empty())
|
||||
section()->selectIndex(0);
|
||||
@ -502,8 +502,8 @@ private:
|
||||
continue;
|
||||
|
||||
KeyItem* keyItem = new KeyItem(
|
||||
menuItem->getText().c_str(),
|
||||
menuItem->getKey(), menuItem, level);
|
||||
menuItem->text().c_str(),
|
||||
menuItem->key(), menuItem, level);
|
||||
|
||||
listbox->addChild(keyItem);
|
||||
|
||||
@ -538,7 +538,7 @@ void KeyboardShortcutsCommand::onExecute(Context* context)
|
||||
KeyboardShortcutsWindow window;
|
||||
|
||||
window.setBounds(gfx::Rect(0, 0, ui::display_w()*3/4, ui::display_h()*3/4));
|
||||
g_sep = window.getBounds().w / 2;
|
||||
g_sep = window.bounds().w / 2;
|
||||
|
||||
window.centerWindow();
|
||||
window.setVisible(true);
|
||||
|
@ -118,7 +118,7 @@ private:
|
||||
}
|
||||
|
||||
std::string nameValue() const {
|
||||
return name()->getText();
|
||||
return name()->text();
|
||||
}
|
||||
|
||||
BlendMode blendModeValue() const {
|
||||
|
@ -74,7 +74,7 @@ void MaskContentCommand::onExecute(Context* context)
|
||||
Mask newMask;
|
||||
gfx::Rect imgBounds = cel->image()->bounds();
|
||||
if (algorithm::shrink_bounds(cel->image(), imgBounds, color)) {
|
||||
newMask.replace(imgBounds.offset(cel->bounds().getOrigin()));
|
||||
newMask.replace(imgBounds.offset(cel->bounds().origin()));
|
||||
}
|
||||
else {
|
||||
newMask.replace(cel->bounds());
|
||||
|
@ -93,7 +93,7 @@ void MoveMaskCommand::onExecute(Context* context)
|
||||
{
|
||||
DocumentPreferences& docPref = Preferences::instance().document(context->activeDocument());
|
||||
ui::View* view = ui::View::getView(current_editor);
|
||||
gfx::Rect vp = view->getViewportBounds();
|
||||
gfx::Rect vp = view->viewportBounds();
|
||||
gfx::Rect gridBounds = docPref.grid.bounds();
|
||||
int dx = 0;
|
||||
int dy = 0;
|
||||
@ -140,7 +140,7 @@ void MoveMaskCommand::onExecute(Context* context)
|
||||
Document* document(writer.document());
|
||||
{
|
||||
Transaction transaction(writer.context(), "Move Selection", DoesntModifyDocument);
|
||||
gfx::Point pt = document->mask()->bounds().getOrigin();
|
||||
gfx::Point pt = document->mask()->bounds().origin();
|
||||
document->getApi(transaction).setMaskPosition(pt.x+dx, pt.y+dy);
|
||||
transaction.commit();
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ void NewBrushCommand::createBrush(const Site& site, const Mask* mask)
|
||||
// New brush
|
||||
doc::BrushRef brush(new doc::Brush());
|
||||
brush->setImage(image.get());
|
||||
brush->setPatternOrigin(mask->bounds().getOrigin());
|
||||
brush->setPatternOrigin(mask->bounds().origin());
|
||||
|
||||
// TODO add a active stock property in app::Context
|
||||
ContextBar* ctxBar = App::instance()->getMainWindow()->getContextBar();
|
||||
|
@ -110,8 +110,8 @@ void NewFileCommand::onExecute(Context* context)
|
||||
|
||||
// Get the options
|
||||
format = (doc::PixelFormat)window.colorMode()->selectedItem();
|
||||
w = window.width()->getTextInt();
|
||||
h = window.height()->getTextInt();
|
||||
w = window.width()->textInt();
|
||||
h = window.height()->textInt();
|
||||
bg = window.bgColor()->selectedItem();
|
||||
|
||||
static_assert(IMAGE_RGB == 0, "RGB pixel format should be 0");
|
||||
|
@ -99,7 +99,7 @@ void NewLayerCommand::onExecute(Context* context)
|
||||
if (window->getKiller() != window->findChild("ok"))
|
||||
return;
|
||||
|
||||
name = window->findChild("name")->getText();
|
||||
name = window->findChild("name")->text();
|
||||
}
|
||||
|
||||
Layer* activeLayer = writer.layer();
|
||||
|
@ -64,7 +64,7 @@ void NewLayerSetCommand::onExecute(Context* context)
|
||||
if (window->getKiller() != window->findChild("ok"))
|
||||
return;
|
||||
|
||||
std::string name = window->findChild("name")->getText();
|
||||
std::string name = window->findChild("name")->text();
|
||||
Layer* layer;
|
||||
{
|
||||
Transaction transaction(writer.context(), "New Layer");
|
||||
|
@ -211,7 +211,7 @@ public:
|
||||
m_curPref->bg.color2(m_checked_bg_color2->getColor());
|
||||
|
||||
int undo_size_limit_value;
|
||||
undo_size_limit_value = undoSizeLimit()->getTextInt();
|
||||
undo_size_limit_value = undoSizeLimit()->textInt();
|
||||
undo_size_limit_value = MID(1, undo_size_limit_value, 9999);
|
||||
|
||||
m_preferences.undo.sizeLimit(undo_size_limit_value);
|
||||
|
@ -198,11 +198,11 @@ void PaletteEditorCommand::onExecute(Context* context)
|
||||
// Default bounds
|
||||
g_window->remapWindow();
|
||||
|
||||
int width = MAX(g_window->getBounds().w, ui::display_w()/2);
|
||||
int width = MAX(g_window->bounds().w, ui::display_w()/2);
|
||||
g_window->setBounds(Rect(
|
||||
ui::display_w() - width - ToolBar::instance()->getBounds().w,
|
||||
ui::display_h() - g_window->getBounds().h - StatusBar::instance()->getBounds().h,
|
||||
width, g_window->getBounds().h));
|
||||
ui::display_w() - width - ToolBar::instance()->bounds().w,
|
||||
ui::display_h() - g_window->bounds().h - StatusBar::instance()->bounds().h,
|
||||
width, g_window->bounds().h));
|
||||
|
||||
// Load window configuration
|
||||
load_window_pos(g_window, "PaletteEditor");
|
||||
|
@ -61,7 +61,7 @@ void PaletteSizeCommand::onExecute(Context* context)
|
||||
window.colors()->setTextf("%d", palette.size());
|
||||
window.openWindowInForeground();
|
||||
if (window.getKiller() == window.ok()) {
|
||||
int ncolors = window.colors()->getTextInt();
|
||||
int ncolors = window.colors()->textInt();
|
||||
if (ncolors == palette.size())
|
||||
return;
|
||||
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
}
|
||||
|
||||
int sizeValue() const {
|
||||
int size = fontSize()->getTextInt();
|
||||
int size = fontSize()->textInt();
|
||||
size = MID(1, size, 5000);
|
||||
return size;
|
||||
}
|
||||
@ -123,7 +123,7 @@ private:
|
||||
}
|
||||
|
||||
if (!m_fontPopup->isVisible()) {
|
||||
gfx::Rect bounds = fontFace()->getBounds();
|
||||
gfx::Rect bounds = fontFace()->bounds();
|
||||
m_fontPopup->showPopup(
|
||||
gfx::Rect(bounds.x, bounds.y+bounds.h,
|
||||
ui::display_w()/2, ui::display_h()/2));
|
||||
@ -159,7 +159,7 @@ void PasteTextCommand::onExecute(Context* ctx)
|
||||
if (window.getKiller() != window.ok())
|
||||
return;
|
||||
|
||||
last_text_used = window.userText()->getText();
|
||||
last_text_used = window.userText()->text();
|
||||
|
||||
bool antialias = window.antialias()->isSelected();
|
||||
std::string faceName = window.faceValue();
|
||||
@ -170,7 +170,7 @@ void PasteTextCommand::onExecute(Context* ctx)
|
||||
pref.textTool.antialias(antialias);
|
||||
|
||||
try {
|
||||
std::string text = window.userText()->getText();
|
||||
std::string text = window.userText()->text();
|
||||
app::Color appColor = window.fontColor()->getColor();
|
||||
doc::color_t color = doc::rgba(appColor.getRed(),
|
||||
appColor.getGreen(),
|
||||
|
@ -89,8 +89,8 @@ void ScrollCommand::onExecute(Context* context)
|
||||
{
|
||||
DocumentPreferences& docPref = Preferences::instance().document(context->activeDocument());
|
||||
ui::View* view = ui::View::getView(current_editor);
|
||||
gfx::Rect vp = view->getViewportBounds();
|
||||
gfx::Point scroll = view->getViewScroll();
|
||||
gfx::Rect vp = view->viewportBounds();
|
||||
gfx::Point scroll = view->viewScroll();
|
||||
gfx::Rect gridBounds = docPref.grid.bounds();
|
||||
gfx::Point delta(0, 0);
|
||||
int pixels = 0;
|
||||
|
@ -184,7 +184,7 @@ private:
|
||||
void onWidthPxChange() {
|
||||
const ContextReader reader(m_ctx);
|
||||
const Sprite* sprite(reader.sprite());
|
||||
int width = widthPx()->getTextInt();
|
||||
int width = widthPx()->textInt();
|
||||
double perc = 100.0 * width / sprite->width();
|
||||
|
||||
widthPerc()->setTextf(PERC_FORMAT, perc);
|
||||
@ -198,7 +198,7 @@ private:
|
||||
void onHeightPxChange() {
|
||||
const ContextReader reader(m_ctx);
|
||||
const Sprite* sprite(reader.sprite());
|
||||
int height = heightPx()->getTextInt();
|
||||
int height = heightPx()->textInt();
|
||||
double perc = 100.0 * height / sprite->height();
|
||||
|
||||
heightPerc()->setTextf(PERC_FORMAT, perc);
|
||||
@ -212,26 +212,26 @@ private:
|
||||
void onWidthPercChange() {
|
||||
const ContextReader reader(m_ctx);
|
||||
const Sprite* sprite(reader.sprite());
|
||||
double width = widthPerc()->getTextDouble();
|
||||
double width = widthPerc()->textDouble();
|
||||
|
||||
widthPx()->setTextf("%d", (int)(sprite->width() * width / 100));
|
||||
|
||||
if (lockRatio()->isSelected()) {
|
||||
heightPx()->setTextf("%d", (int)(sprite->height() * width / 100));
|
||||
heightPerc()->setText(widthPerc()->getText());
|
||||
heightPerc()->setText(widthPerc()->text());
|
||||
}
|
||||
}
|
||||
|
||||
void onHeightPercChange() {
|
||||
const ContextReader reader(m_ctx);
|
||||
const Sprite* sprite(reader.sprite());
|
||||
double height = heightPerc()->getTextDouble();
|
||||
double height = heightPerc()->textDouble();
|
||||
|
||||
heightPx()->setTextf("%d", (int)(sprite->height() * height / 100));
|
||||
|
||||
if (lockRatio()->isSelected()) {
|
||||
widthPx()->setTextf("%d", (int)(sprite->width() * height / 100));
|
||||
widthPerc()->setText(heightPerc()->getText());
|
||||
widthPerc()->setText(heightPerc()->text());
|
||||
}
|
||||
}
|
||||
|
||||
@ -313,8 +313,8 @@ void SpriteSizeCommand::onExecute(Context* context)
|
||||
if (window.getKiller() != window.ok())
|
||||
return;
|
||||
|
||||
new_width = window.widthPx()->getTextInt();
|
||||
new_height = window.heightPx()->getTextInt();
|
||||
new_width = window.widthPx()->textInt();
|
||||
new_height = window.heightPx()->textInt();
|
||||
resize_method = (ResizeMethod)window.method()->getSelectedItemIndex();
|
||||
|
||||
set_config_int("SpriteSize", "Method", resize_method);
|
||||
|
@ -88,7 +88,7 @@ void UndoCommand::onExecute(Context* context)
|
||||
current_editor->drawSpriteClipped(
|
||||
gfx::Region(gfx::Rect(0, 0, sprite->width(), sprite->height())));
|
||||
|
||||
current_editor->getManager()->flipDisplay();
|
||||
current_editor->manager()->flipDisplay();
|
||||
base::this_thread::sleep_for(0.01);
|
||||
}
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ private:
|
||||
|
||||
void clearList() {
|
||||
ui::Widget* child;
|
||||
while ((child = actions()->getFirstChild()))
|
||||
while ((child = actions()->firstChild()))
|
||||
delete child;
|
||||
|
||||
actions()->layout();
|
||||
|
@ -105,7 +105,7 @@ private:
|
||||
|
||||
if (oldSelected) {
|
||||
for (auto child : m_stockListBox->children()) {
|
||||
if (child->getText() == oldSelected) {
|
||||
if (child->text() == oldSelected) {
|
||||
select_this = child;
|
||||
break;
|
||||
}
|
||||
@ -123,7 +123,7 @@ private:
|
||||
void onMatrixChange()
|
||||
{
|
||||
Widget* selected = m_stockListBox->getSelectedChild();
|
||||
base::SharedPtr<ConvolutionMatrix> matrix = m_stock.getByName(selected->getText().c_str());
|
||||
base::SharedPtr<ConvolutionMatrix> matrix = m_stock.getByName(selected->text().c_str());
|
||||
Target newTarget = matrix->getDefaultTarget();
|
||||
|
||||
m_filter.setMatrix(matrix);
|
||||
|
@ -61,8 +61,8 @@ public:
|
||||
private:
|
||||
void onSizeChange()
|
||||
{
|
||||
m_filter.setSize(m_widthEntry->getTextInt(),
|
||||
m_heightEntry->getTextInt());
|
||||
m_filter.setSize(m_widthEntry->textInt(),
|
||||
m_heightEntry->textInt());
|
||||
restartPreview();
|
||||
}
|
||||
|
||||
|
@ -185,9 +185,9 @@ void ColorCurveEditor::onSizeHint(SizeHintEvent& ev)
|
||||
|
||||
void ColorCurveEditor::onPaint(ui::PaintEvent& ev)
|
||||
{
|
||||
ui::Graphics* g = ev.getGraphics();
|
||||
gfx::Rect rc = getClientBounds();
|
||||
gfx::Rect client = getClientChildrenBounds();
|
||||
ui::Graphics* g = ev.graphics();
|
||||
gfx::Rect rc = clientBounds();
|
||||
gfx::Rect client = clientChildrenBounds();
|
||||
gfx::Point pt;
|
||||
int c;
|
||||
|
||||
@ -267,8 +267,8 @@ bool ColorCurveEditor::editNodeManually(gfx::Point& viewPt)
|
||||
window.openWindowInForeground();
|
||||
|
||||
if (window.getKiller() == window.ok()) {
|
||||
viewPt.x = int(window.x()->getTextDouble());
|
||||
viewPt.y = int(window.y()->getTextDouble());
|
||||
viewPt.x = int(window.x()->textDouble());
|
||||
viewPt.y = int(window.y()->textDouble());
|
||||
viewPt.x = MID(0, viewPt.x, 255);
|
||||
viewPt.y = MID(0, viewPt.y, 255);
|
||||
return true;
|
||||
@ -285,7 +285,7 @@ bool ColorCurveEditor::editNodeManually(gfx::Point& viewPt)
|
||||
|
||||
gfx::Point ColorCurveEditor::viewToClient(const gfx::Point& viewPt)
|
||||
{
|
||||
gfx::Rect client = getClientChildrenBounds();
|
||||
gfx::Rect client = clientChildrenBounds();
|
||||
return gfx::Point(
|
||||
client.x + client.w * (viewPt.x - m_viewBounds.x) / m_viewBounds.w,
|
||||
client.y + client.h-1 - (client.h-1) * (viewPt.y - m_viewBounds.y) / m_viewBounds.h);
|
||||
@ -293,12 +293,12 @@ gfx::Point ColorCurveEditor::viewToClient(const gfx::Point& viewPt)
|
||||
|
||||
gfx::Point ColorCurveEditor::screenToView(const gfx::Point& screenPt)
|
||||
{
|
||||
return clientToView(screenPt - getBounds().getOrigin());
|
||||
return clientToView(screenPt - bounds().origin());
|
||||
}
|
||||
|
||||
gfx::Point ColorCurveEditor::clientToView(const gfx::Point& clientPt)
|
||||
{
|
||||
gfx::Rect client = getClientChildrenBounds();
|
||||
gfx::Rect client = clientChildrenBounds();
|
||||
return gfx::Point(
|
||||
m_viewBounds.x + m_viewBounds.w * (clientPt.x - client.x) / client.w,
|
||||
m_viewBounds.y + m_viewBounds.h-1 - (m_viewBounds.h-1) * (clientPt.y - client.y) / client.h);
|
||||
|
@ -125,7 +125,7 @@ void FilterManagerImpl::beginForPreview()
|
||||
{
|
||||
Editor* editor = current_editor;
|
||||
Sprite* sprite = m_site.sprite();
|
||||
gfx::Rect vp = View::getView(editor)->getViewportBounds();
|
||||
gfx::Rect vp = View::getView(editor)->viewportBounds();
|
||||
vp = editor->screenToEditor(vp);
|
||||
vp = vp.createIntersection(sprite->bounds());
|
||||
|
||||
|
@ -138,7 +138,7 @@ void Console::printf(const char* format, ...)
|
||||
wid_console->invalidate();
|
||||
}
|
||||
|
||||
const std::string& text = wid_textbox->getText();
|
||||
const std::string& text = wid_textbox->text();
|
||||
|
||||
std::string final;
|
||||
if (!text.empty())
|
||||
|
@ -138,7 +138,7 @@ public:
|
||||
const gfx::Rect& inTextureBounds() const { return m_bounds->inTextureBounds(); }
|
||||
|
||||
gfx::Size requiredSize() const {
|
||||
gfx::Size size = m_bounds->trimmedBounds().getSize();
|
||||
gfx::Size size = m_bounds->trimmedBounds().size();
|
||||
size.w += 2*m_innerPadding;
|
||||
size.h += 2*m_innerPadding;
|
||||
return size;
|
||||
|
@ -45,7 +45,7 @@ void ExtraCel::create(doc::Sprite* sprite,
|
||||
m_cel.reset(new doc::Cel(doc::frame_t(0), doc::ImageRef(nullptr)));
|
||||
}
|
||||
|
||||
m_cel->setPosition(bounds.getOrigin());
|
||||
m_cel->setPosition(bounds.origin());
|
||||
m_cel->setOpacity(opacity);
|
||||
m_cel->setFrame(frame);
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ std::string show_file_selector(
|
||||
dlg->addFilter(tok, tok + " files (*." + tok + ")");
|
||||
|
||||
if (dlg->show(she::instance()->defaultDisplay()))
|
||||
res = dlg->getFileName();
|
||||
res = dlg->fileName();
|
||||
|
||||
dlg->dispose();
|
||||
return res;
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
/* Some of the original code to handle PIDLs come from the
|
||||
MiniExplorer example of the Vaca library:
|
||||
http://vaca.sourceforge.net/
|
||||
https://github.com/dacap/vaca
|
||||
Copyright (C) by David Capello (MIT License)
|
||||
*/
|
||||
|
||||
@ -54,19 +54,19 @@ namespace app {
|
||||
// a position in the file-system
|
||||
class FileItem : public IFileItem {
|
||||
public:
|
||||
std::string keyname;
|
||||
std::string filename;
|
||||
std::string displayname;
|
||||
FileItem* parent;
|
||||
FileItemList children;
|
||||
unsigned int version;
|
||||
bool removed;
|
||||
bool is_folder;
|
||||
std::string m_keyname;
|
||||
std::string m_filename;
|
||||
std::string m_displayname;
|
||||
FileItem* m_parent;
|
||||
FileItemList m_children;
|
||||
unsigned int m_version;
|
||||
bool m_removed;
|
||||
bool m_is_folder;
|
||||
#ifdef _WIN32
|
||||
LPITEMIDLIST pidl; // relative to parent
|
||||
LPITEMIDLIST fullpidl; // relative to the Desktop folder
|
||||
// (like a full path-name, because the
|
||||
// desktop is the root on Windows)
|
||||
LPITEMIDLIST m_pidl; // relative to parent
|
||||
LPITEMIDLIST m_fullpidl; // relative to the Desktop folder
|
||||
// (like a full path-name, because the
|
||||
// desktop is the root on Windows)
|
||||
#endif
|
||||
|
||||
FileItem(FileItem* parent);
|
||||
@ -86,12 +86,12 @@ public:
|
||||
bool isBrowsable() const;
|
||||
bool isHidden() const;
|
||||
|
||||
std::string getKeyName() const;
|
||||
std::string getFileName() const;
|
||||
std::string getDisplayName() const;
|
||||
std::string keyName() const;
|
||||
std::string fileName() const;
|
||||
std::string displayName() const;
|
||||
|
||||
IFileItem* getParent() const;
|
||||
const FileItemList& getChildren();
|
||||
IFileItem* parent() const;
|
||||
const FileItemList& children();
|
||||
void createDirectory(const std::string& dirname);
|
||||
|
||||
bool hasExtension(const std::string& csv_extensions);
|
||||
@ -234,8 +234,8 @@ IFileItem* FileSystemModule::getRootFileItem()
|
||||
ASSERT(false);
|
||||
exit(1);
|
||||
}
|
||||
fileitem->pidl = pidl;
|
||||
fileitem->fullpidl = pidl;
|
||||
fileitem->m_pidl = pidl;
|
||||
fileitem->m_fullpidl = pidl;
|
||||
|
||||
SFGAOF attrib = SFGAO_FOLDER;
|
||||
shl_idesktop->GetAttributesOf(1, (LPCITEMIDLIST *)&pidl, &attrib);
|
||||
@ -246,9 +246,9 @@ IFileItem* FileSystemModule::getRootFileItem()
|
||||
{
|
||||
const char* root = "/";
|
||||
|
||||
fileitem->filename = root;
|
||||
fileitem->displayname = root;
|
||||
fileitem->is_folder = true;
|
||||
fileitem->m_filename = root;
|
||||
fileitem->m_displayname = root;
|
||||
fileitem->m_is_folder = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -304,75 +304,75 @@ IFileItem* FileSystemModule::getFileItemFromPath(const std::string& path)
|
||||
|
||||
bool FileItem::isFolder() const
|
||||
{
|
||||
return is_folder;
|
||||
return m_is_folder;
|
||||
}
|
||||
|
||||
bool FileItem::isBrowsable() const
|
||||
{
|
||||
ASSERT(this->filename != NOTINITIALIZED);
|
||||
ASSERT(m_filename != NOTINITIALIZED);
|
||||
|
||||
return is_folder;
|
||||
return m_is_folder;
|
||||
}
|
||||
|
||||
bool FileItem::isHidden() const
|
||||
{
|
||||
ASSERT(this->displayname != NOTINITIALIZED);
|
||||
ASSERT(m_displayname != NOTINITIALIZED);
|
||||
|
||||
#ifdef _WIN32
|
||||
return false;
|
||||
#else
|
||||
return this->displayname[0] == '.';
|
||||
return m_displayname[0] == '.';
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string FileItem::getKeyName() const
|
||||
std::string FileItem::keyName() const
|
||||
{
|
||||
ASSERT(this->keyname != NOTINITIALIZED);
|
||||
ASSERT(m_keyname != NOTINITIALIZED);
|
||||
|
||||
return this->keyname;
|
||||
return m_keyname;
|
||||
}
|
||||
|
||||
std::string FileItem::getFileName() const
|
||||
std::string FileItem::fileName() const
|
||||
{
|
||||
ASSERT(this->filename != NOTINITIALIZED);
|
||||
ASSERT(m_filename != NOTINITIALIZED);
|
||||
|
||||
return this->filename;
|
||||
return m_filename;
|
||||
}
|
||||
|
||||
std::string FileItem::getDisplayName() const
|
||||
std::string FileItem::displayName() const
|
||||
{
|
||||
ASSERT(this->displayname != NOTINITIALIZED);
|
||||
ASSERT(m_displayname != NOTINITIALIZED);
|
||||
|
||||
return this->displayname;
|
||||
return m_displayname;
|
||||
}
|
||||
|
||||
IFileItem* FileItem::getParent() const
|
||||
IFileItem* FileItem::parent() const
|
||||
{
|
||||
if (this == rootitem)
|
||||
return NULL;
|
||||
else {
|
||||
ASSERT(this->parent);
|
||||
return this->parent;
|
||||
ASSERT(m_parent);
|
||||
return m_parent;
|
||||
}
|
||||
}
|
||||
|
||||
const FileItemList& FileItem::getChildren()
|
||||
const FileItemList& FileItem::children()
|
||||
{
|
||||
// Is the file-item a folder?
|
||||
if (isFolder() &&
|
||||
// if the children list is empty, or the file-system version
|
||||
// change (it's like to say: the current this->children list
|
||||
// change (it's like to say: the current m_children list
|
||||
// is outdated)...
|
||||
(this->children.empty() ||
|
||||
current_file_system_version > this->version)) {
|
||||
(m_children.empty() ||
|
||||
current_file_system_version > m_version)) {
|
||||
FileItemList::iterator it;
|
||||
FileItem* child;
|
||||
|
||||
// we have to mark current items as deprecated
|
||||
for (it=this->children.begin();
|
||||
it!=this->children.end(); ++it) {
|
||||
for (it=m_children.begin();
|
||||
it!=m_children.end(); ++it) {
|
||||
child = static_cast<FileItem*>(*it);
|
||||
child->removed = true;
|
||||
child->m_removed = true;
|
||||
}
|
||||
|
||||
//LOG("FS: Loading files for %p (%s)\n", fileitem, fileitem->displayname);
|
||||
@ -384,7 +384,7 @@ const FileItemList& FileItem::getChildren()
|
||||
if (this == rootitem)
|
||||
pFolder = shl_idesktop;
|
||||
else {
|
||||
hr = shl_idesktop->BindToObject(this->fullpidl,
|
||||
hr = shl_idesktop->BindToObject(m_fullpidl,
|
||||
NULL, IID_IShellFolder, (LPVOID *)&pFolder);
|
||||
|
||||
if (hr != S_OK)
|
||||
@ -414,26 +414,26 @@ const FileItemList& FileItem::getChildren()
|
||||
|
||||
/* generate the FileItems */
|
||||
for (c=0; c<fetched; ++c) {
|
||||
LPITEMIDLIST fullpidl = concat_pidl(this->fullpidl,
|
||||
LPITEMIDLIST fullpidl = concat_pidl(m_fullpidl,
|
||||
itempidl[c]);
|
||||
|
||||
child = get_fileitem_by_fullpidl(fullpidl, false);
|
||||
if (!child) {
|
||||
child = new FileItem(this);
|
||||
|
||||
child->pidl = itempidl[c];
|
||||
child->fullpidl = fullpidl;
|
||||
child->m_pidl = itempidl[c];
|
||||
child->m_fullpidl = fullpidl;
|
||||
|
||||
update_by_pidl(child, attribs[c]);
|
||||
put_fileitem(child);
|
||||
}
|
||||
else {
|
||||
ASSERT(child->parent == this);
|
||||
ASSERT(child->m_parent == this);
|
||||
free_pidl(fullpidl);
|
||||
free_pidl(itempidl[c]);
|
||||
}
|
||||
|
||||
this->insertChildSorted(child);
|
||||
insertChildSorted(child);
|
||||
}
|
||||
}
|
||||
|
||||
@ -446,13 +446,13 @@ const FileItemList& FileItem::getChildren()
|
||||
}
|
||||
#else
|
||||
{
|
||||
DIR* dir = opendir(this->filename.c_str());
|
||||
DIR* dir = opendir(m_filename.c_str());
|
||||
if (dir) {
|
||||
dirent* entry;
|
||||
while ((entry = readdir(dir)) != NULL) {
|
||||
FileItem* child;
|
||||
std::string fn = entry->d_name;
|
||||
std::string fullfn = base::join_path(filename, fn);
|
||||
std::string fullfn = base::join_path(m_filename, fn);
|
||||
|
||||
if (fn == "." || fn == "..")
|
||||
continue;
|
||||
@ -469,14 +469,14 @@ const FileItemList& FileItem::getChildren()
|
||||
is_folder = (entry->d_type == DT_DIR);
|
||||
}
|
||||
|
||||
child->filename = fullfn;
|
||||
child->displayname = fn;
|
||||
child->is_folder = is_folder;
|
||||
child->m_filename = fullfn;
|
||||
child->m_displayname = fn;
|
||||
child->m_is_folder = is_folder;
|
||||
|
||||
put_fileitem(child);
|
||||
}
|
||||
else {
|
||||
ASSERT(child->parent == this);
|
||||
ASSERT(child->m_parent == this);
|
||||
}
|
||||
|
||||
insertChildSorted(child);
|
||||
@ -487,15 +487,15 @@ const FileItemList& FileItem::getChildren()
|
||||
#endif
|
||||
|
||||
// check old file-items (maybe removed directories or file-items)
|
||||
for (it=this->children.begin();
|
||||
it!=this->children.end(); ) {
|
||||
for (it=m_children.begin();
|
||||
it!=m_children.end(); ) {
|
||||
child = static_cast<FileItem*>(*it);
|
||||
ASSERT(child != NULL);
|
||||
|
||||
if (child && child->removed) {
|
||||
it = this->children.erase(it);
|
||||
if (child && child->m_removed) {
|
||||
it = m_children.erase(it);
|
||||
|
||||
fileitems_map->erase(fileitems_map->find(child->keyname));
|
||||
fileitems_map->erase(fileitems_map->find(child->m_keyname));
|
||||
delete child;
|
||||
}
|
||||
else
|
||||
@ -503,30 +503,30 @@ const FileItemList& FileItem::getChildren()
|
||||
}
|
||||
|
||||
// now this file-item is updated
|
||||
this->version = current_file_system_version;
|
||||
m_version = current_file_system_version;
|
||||
}
|
||||
|
||||
return this->children;
|
||||
return m_children;
|
||||
}
|
||||
|
||||
void FileItem::createDirectory(const std::string& dirname)
|
||||
{
|
||||
base::make_directory(base::join_path(filename, dirname));
|
||||
base::make_directory(base::join_path(m_filename, dirname));
|
||||
|
||||
// Invalidate the children list.
|
||||
this->version = 0;
|
||||
m_version = 0;
|
||||
}
|
||||
|
||||
bool FileItem::hasExtension(const std::string& csv_extensions)
|
||||
{
|
||||
ASSERT(this->filename != NOTINITIALIZED);
|
||||
ASSERT(m_filename != NOTINITIALIZED);
|
||||
|
||||
return base::has_file_extension(this->filename, csv_extensions);
|
||||
return base::has_file_extension(m_filename, csv_extensions);
|
||||
}
|
||||
|
||||
she::Surface* FileItem::getThumbnail()
|
||||
{
|
||||
ThumbnailMap::iterator it = thumbnail_map->find(this->filename);
|
||||
ThumbnailMap::iterator it = thumbnail_map->find(m_filename);
|
||||
if (it != thumbnail_map->end())
|
||||
return it->second;
|
||||
else
|
||||
@ -536,46 +536,46 @@ she::Surface* FileItem::getThumbnail()
|
||||
void FileItem::setThumbnail(she::Surface* thumbnail)
|
||||
{
|
||||
// destroy the current thumbnail of the file (if exists)
|
||||
ThumbnailMap::iterator it = thumbnail_map->find(this->filename);
|
||||
ThumbnailMap::iterator it = thumbnail_map->find(m_filename);
|
||||
if (it != thumbnail_map->end()) {
|
||||
it->second->dispose();
|
||||
thumbnail_map->erase(it);
|
||||
}
|
||||
|
||||
// insert the new one in the map
|
||||
thumbnail_map->insert(std::make_pair(this->filename, thumbnail));
|
||||
thumbnail_map->insert(std::make_pair(m_filename, thumbnail));
|
||||
}
|
||||
|
||||
FileItem::FileItem(FileItem* parent)
|
||||
{
|
||||
//LOG("FS: Creating %p fileitem with parent %p\n", this, parent);
|
||||
|
||||
this->keyname = NOTINITIALIZED;
|
||||
this->filename = NOTINITIALIZED;
|
||||
this->displayname = NOTINITIALIZED;
|
||||
this->parent = parent;
|
||||
this->version = current_file_system_version;
|
||||
this->removed = false;
|
||||
this->is_folder = false;
|
||||
m_keyname = NOTINITIALIZED;
|
||||
m_filename = NOTINITIALIZED;
|
||||
m_displayname = NOTINITIALIZED;
|
||||
m_parent = parent;
|
||||
m_version = current_file_system_version;
|
||||
m_removed = false;
|
||||
m_is_folder = false;
|
||||
#ifdef _WIN32
|
||||
this->pidl = NULL;
|
||||
this->fullpidl = NULL;
|
||||
m_pidl = NULL;
|
||||
m_fullpidl = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
FileItem::~FileItem()
|
||||
{
|
||||
LOG("FS: Destroying FileItem() with parent %p\n", parent);
|
||||
LOG("FS: Destroying FileItem() with parent %p\n", m_parent);
|
||||
|
||||
#ifdef _WIN32
|
||||
if (this->fullpidl && this->fullpidl != this->pidl) {
|
||||
free_pidl(this->fullpidl);
|
||||
this->fullpidl = NULL;
|
||||
if (m_fullpidl && m_fullpidl != m_pidl) {
|
||||
free_pidl(m_fullpidl);
|
||||
m_fullpidl = NULL;
|
||||
}
|
||||
|
||||
if (this->pidl) {
|
||||
free_pidl(this->pidl);
|
||||
this->pidl = NULL;
|
||||
if (m_pidl) {
|
||||
free_pidl(m_pidl);
|
||||
m_pidl = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -583,21 +583,20 @@ FileItem::~FileItem()
|
||||
void FileItem::insertChildSorted(FileItem* child)
|
||||
{
|
||||
// this file-item wasn't removed from the last lookup
|
||||
child->removed = false;
|
||||
child->m_removed = false;
|
||||
|
||||
// if the fileitem is already in the list we can go back
|
||||
if (std::find(children.begin(), children.end(), child) != children.end())
|
||||
if (std::find(m_children.begin(), m_children.end(), child) != m_children.end())
|
||||
return;
|
||||
|
||||
for (FileItemList::iterator
|
||||
it=children.begin(); it!=children.end(); ++it) {
|
||||
for (auto it=m_children.begin(), end=m_children.end(); it!=end; ++it) {
|
||||
if (*child < *static_cast<FileItem*>(*it)) {
|
||||
children.insert(it, child);
|
||||
m_children.insert(it, child);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
children.push_back(child);
|
||||
m_children.push_back(child);
|
||||
}
|
||||
|
||||
int FileItem::compare(const FileItem& that) const
|
||||
@ -609,7 +608,7 @@ int FileItem::compare(const FileItem& that) const
|
||||
else if (that.isFolder())
|
||||
return 1;
|
||||
|
||||
return base::compare_filenames(this->displayname, that.displayname);
|
||||
return base::compare_filenames(m_displayname, that.m_displayname);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
@ -636,8 +635,8 @@ static void update_by_pidl(FileItem* fileitem, SFGAOF attrib)
|
||||
if (fileitem == rootitem)
|
||||
pFolder = shl_idesktop;
|
||||
else {
|
||||
ASSERT(fileitem->parent);
|
||||
hr = shl_idesktop->BindToObject(fileitem->parent->fullpidl,
|
||||
ASSERT(fileitem->m_parent);
|
||||
hr = shl_idesktop->BindToObject(fileitem->m_parent->m_fullpidl,
|
||||
NULL, IID_IShellFolder, (LPVOID *)&pFolder);
|
||||
if (hr != S_OK)
|
||||
pFolder = NULL;
|
||||
@ -646,44 +645,44 @@ static void update_by_pidl(FileItem* fileitem, SFGAOF attrib)
|
||||
// Get the file name
|
||||
|
||||
if (pFolder != NULL &&
|
||||
pFolder->GetDisplayNameOf(fileitem->pidl,
|
||||
pFolder->GetDisplayNameOf(fileitem->m_pidl,
|
||||
SHGDN_NORMAL | SHGDN_FORPARSING,
|
||||
&strret) == S_OK) {
|
||||
StrRetToBuf(&strret, fileitem->pidl, pszName, MAX_PATH);
|
||||
fileitem->filename = base::to_utf8(pszName);
|
||||
StrRetToBuf(&strret, fileitem->m_pidl, pszName, MAX_PATH);
|
||||
fileitem->m_filename = base::to_utf8(pszName);
|
||||
}
|
||||
else if (shl_idesktop->GetDisplayNameOf(fileitem->fullpidl,
|
||||
else if (shl_idesktop->GetDisplayNameOf(fileitem->m_fullpidl,
|
||||
SHGDN_NORMAL | SHGDN_FORPARSING,
|
||||
&strret) == S_OK) {
|
||||
StrRetToBuf(&strret, fileitem->fullpidl, pszName, MAX_PATH);
|
||||
fileitem->filename = base::to_utf8(pszName);
|
||||
StrRetToBuf(&strret, fileitem->m_fullpidl, pszName, MAX_PATH);
|
||||
fileitem->m_filename = base::to_utf8(pszName);
|
||||
}
|
||||
else
|
||||
fileitem->filename = "ERR";
|
||||
fileitem->m_filename = "ERR";
|
||||
|
||||
// Is it a folder?
|
||||
|
||||
fileitem->is_folder = calc_is_folder(fileitem->filename, attrib);
|
||||
fileitem->m_is_folder = calc_is_folder(fileitem->m_filename, attrib);
|
||||
|
||||
// Get the name to display
|
||||
|
||||
if (fileitem->isFolder() &&
|
||||
pFolder &&
|
||||
pFolder->GetDisplayNameOf(fileitem->pidl,
|
||||
pFolder->GetDisplayNameOf(fileitem->m_pidl,
|
||||
SHGDN_INFOLDER,
|
||||
&strret) == S_OK) {
|
||||
StrRetToBuf(&strret, fileitem->pidl, pszName, MAX_PATH);
|
||||
fileitem->displayname = base::to_utf8(pszName);
|
||||
StrRetToBuf(&strret, fileitem->m_pidl, pszName, MAX_PATH);
|
||||
fileitem->m_displayname = base::to_utf8(pszName);
|
||||
}
|
||||
else if (fileitem->isFolder() &&
|
||||
shl_idesktop->GetDisplayNameOf(fileitem->fullpidl,
|
||||
shl_idesktop->GetDisplayNameOf(fileitem->m_fullpidl,
|
||||
SHGDN_INFOLDER,
|
||||
&strret) == S_OK) {
|
||||
StrRetToBuf(&strret, fileitem->fullpidl, pszName, MAX_PATH);
|
||||
fileitem->displayname = base::to_utf8(pszName);
|
||||
StrRetToBuf(&strret, fileitem->m_fullpidl, pszName, MAX_PATH);
|
||||
fileitem->m_displayname = base::to_utf8(pszName);
|
||||
}
|
||||
else {
|
||||
fileitem->displayname = base::get_file_name(fileitem->filename);
|
||||
fileitem->m_displayname = base::get_file_name(fileitem->m_filename);
|
||||
}
|
||||
|
||||
if (pFolder != NULL && pFolder != shl_idesktop) {
|
||||
@ -860,16 +859,16 @@ static FileItem* get_fileitem_by_fullpidl(LPITEMIDLIST fullpidl, bool create_if_
|
||||
|
||||
// new file-item
|
||||
FileItem* fileitem = new FileItem(NULL);
|
||||
fileitem->fullpidl = clone_pidl(fullpidl);
|
||||
fileitem->m_fullpidl = clone_pidl(fullpidl);
|
||||
|
||||
SFGAOF attrib = SFGAO_FOLDER;
|
||||
HRESULT hr = shl_idesktop->GetAttributesOf(1, (LPCITEMIDLIST *)&fileitem->fullpidl, &attrib);
|
||||
HRESULT hr = shl_idesktop->GetAttributesOf(1, (LPCITEMIDLIST *)&fileitem->m_fullpidl, &attrib);
|
||||
if (hr == S_OK) {
|
||||
LPITEMIDLIST parent_fullpidl = clone_pidl(fileitem->fullpidl);
|
||||
LPITEMIDLIST parent_fullpidl = clone_pidl(fileitem->m_fullpidl);
|
||||
remove_last_pidl(parent_fullpidl);
|
||||
|
||||
fileitem->pidl = get_last_pidl(fileitem->fullpidl);
|
||||
fileitem->parent = get_fileitem_by_fullpidl(parent_fullpidl, true);
|
||||
fileitem->m_pidl = get_last_pidl(fileitem->m_fullpidl);
|
||||
fileitem->m_parent = get_fileitem_by_fullpidl(parent_fullpidl, true);
|
||||
|
||||
free_pidl(parent_fullpidl);
|
||||
}
|
||||
@ -887,20 +886,20 @@ static FileItem* get_fileitem_by_fullpidl(LPITEMIDLIST fullpidl, bool create_if_
|
||||
*/
|
||||
static void put_fileitem(FileItem* fileitem)
|
||||
{
|
||||
ASSERT(fileitem->filename != NOTINITIALIZED);
|
||||
ASSERT(fileitem->keyname == NOTINITIALIZED);
|
||||
ASSERT(fileitem->m_filename != NOTINITIALIZED);
|
||||
ASSERT(fileitem->m_keyname == NOTINITIALIZED);
|
||||
|
||||
fileitem->keyname = get_key_for_pidl(fileitem->fullpidl);
|
||||
fileitem->m_keyname = get_key_for_pidl(fileitem->m_fullpidl);
|
||||
|
||||
ASSERT(fileitem->keyname != NOTINITIALIZED);
|
||||
ASSERT(fileitem->m_keyname != NOTINITIALIZED);
|
||||
|
||||
#ifdef _DEBUG
|
||||
FileItemMap::iterator it = fileitems_map->find(get_key_for_pidl(fileitem->fullpidl));
|
||||
auto it = fileitems_map->find(get_key_for_pidl(fileitem->m_fullpidl));
|
||||
ASSERT(it == fileitems_map->end());
|
||||
#endif
|
||||
|
||||
// insert this file-item in the hash-table
|
||||
fileitems_map->insert(std::make_pair(fileitem->keyname, fileitem));
|
||||
fileitems_map->insert(std::make_pair(fileitem->m_keyname, fileitem));
|
||||
}
|
||||
|
||||
#else
|
||||
@ -933,14 +932,14 @@ static FileItem* get_fileitem_by_path(const std::string& path, bool create_if_no
|
||||
// new file-item
|
||||
FileItem* fileitem = new FileItem(NULL);
|
||||
|
||||
fileitem->filename = path;
|
||||
fileitem->displayname = base::get_file_name(path);
|
||||
fileitem->is_folder = is_folder;
|
||||
fileitem->m_filename = path;
|
||||
fileitem->m_displayname = base::get_file_name(path);
|
||||
fileitem->m_is_folder = is_folder;
|
||||
|
||||
// get the parent
|
||||
{
|
||||
std::string parent_path = remove_backslash_if_needed(base::join_path(base::get_file_path(path), ""));
|
||||
fileitem->parent = get_fileitem_by_path(parent_path, true);
|
||||
fileitem->m_parent = get_fileitem_by_path(parent_path, true);
|
||||
}
|
||||
|
||||
put_fileitem(fileitem);
|
||||
@ -971,15 +970,15 @@ static std::string get_key_for_filename(const std::string& filename)
|
||||
|
||||
static void put_fileitem(FileItem* fileitem)
|
||||
{
|
||||
ASSERT(fileitem->filename != NOTINITIALIZED);
|
||||
ASSERT(fileitem->keyname == NOTINITIALIZED);
|
||||
ASSERT(fileitem->m_filename != NOTINITIALIZED);
|
||||
ASSERT(fileitem->m_keyname == NOTINITIALIZED);
|
||||
|
||||
fileitem->keyname = get_key_for_filename(fileitem->filename);
|
||||
fileitem->m_keyname = get_key_for_filename(fileitem->m_filename);
|
||||
|
||||
ASSERT(fileitem->keyname != NOTINITIALIZED);
|
||||
ASSERT(fileitem->m_keyname != NOTINITIALIZED);
|
||||
|
||||
// insert this file-item in the hash-table
|
||||
fileitems_map->insert(std::make_pair(fileitem->keyname, fileitem));
|
||||
fileitems_map->insert(std::make_pair(fileitem->m_keyname, fileitem));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -34,7 +34,7 @@ namespace app {
|
||||
static FileSystemModule* instance();
|
||||
|
||||
// Marks all FileItems as deprecated to be refresh the next time
|
||||
// they are queried through @ref FileItem::getChildren().
|
||||
// they are queried through @ref FileItem::children().
|
||||
void refresh();
|
||||
|
||||
IFileItem* getRootFileItem();
|
||||
@ -70,12 +70,12 @@ namespace app {
|
||||
virtual bool isBrowsable() const = 0;
|
||||
virtual bool isHidden() const = 0;
|
||||
|
||||
virtual std::string getKeyName() const = 0;
|
||||
virtual std::string getFileName() const = 0;
|
||||
virtual std::string getDisplayName() const = 0;
|
||||
virtual std::string keyName() const = 0;
|
||||
virtual std::string fileName() const = 0;
|
||||
virtual std::string displayName() const = 0;
|
||||
|
||||
virtual IFileItem* getParent() const = 0;
|
||||
virtual const FileItemList& getChildren() = 0;
|
||||
virtual IFileItem* parent() const = 0;
|
||||
virtual const FileItemList& children() = 0;
|
||||
virtual void createDirectory(const std::string& dirname) = 0;
|
||||
|
||||
virtual bool hasExtension(const std::string& csv_extensions) = 0;
|
||||
|
@ -113,14 +113,14 @@ void draw_color_button(ui::Graphics* g,
|
||||
// Draw opaque border
|
||||
theme->drawRect(
|
||||
g, rc,
|
||||
theme->parts.colorbar0()->getBitmapNW(),
|
||||
theme->parts.colorbar0()->getBitmapN(),
|
||||
theme->parts.colorbar1()->getBitmapNE(),
|
||||
theme->parts.colorbar1()->getBitmapE(),
|
||||
theme->parts.colorbar3()->getBitmapSE(),
|
||||
theme->parts.colorbar2()->getBitmapS(),
|
||||
theme->parts.colorbar2()->getBitmapSW(),
|
||||
theme->parts.colorbar0()->getBitmapW());
|
||||
theme->parts.colorbar0()->bitmapNW(),
|
||||
theme->parts.colorbar0()->bitmapN(),
|
||||
theme->parts.colorbar1()->bitmapNE(),
|
||||
theme->parts.colorbar1()->bitmapE(),
|
||||
theme->parts.colorbar3()->bitmapSE(),
|
||||
theme->parts.colorbar2()->bitmapS(),
|
||||
theme->parts.colorbar2()->bitmapSW(),
|
||||
theme->parts.colorbar0()->bitmapW());
|
||||
|
||||
// Draw hot
|
||||
if (hot) {
|
||||
|
@ -241,7 +241,7 @@ void update_screen_for_document(const Document* document)
|
||||
void load_window_pos(Widget* window, const char *section)
|
||||
{
|
||||
// Default position
|
||||
Rect orig_pos = window->getBounds();
|
||||
Rect orig_pos = window->bounds();
|
||||
Rect pos = orig_pos;
|
||||
|
||||
// Load configurated position
|
||||
@ -258,7 +258,7 @@ void load_window_pos(Widget* window, const char *section)
|
||||
|
||||
void save_window_pos(Widget* window, const char *section)
|
||||
{
|
||||
set_config_rect(section, "WindowPos", window->getBounds());
|
||||
set_config_rect(section, "WindowPos", window->bounds());
|
||||
}
|
||||
|
||||
Widget* setup_mini_font(Widget* widget)
|
||||
@ -486,24 +486,26 @@ void CustomizedGuiManager::onNewDisplayConfiguration()
|
||||
|
||||
std::string CustomizedGuiManager::loadLayout(Widget* widget)
|
||||
{
|
||||
if (widget->getRoot() == NULL)
|
||||
if (widget->window() == nullptr)
|
||||
return "";
|
||||
|
||||
std::string rootId = widget->getRoot()->getId();
|
||||
std::string widgetId = widget->getId();
|
||||
std::string windowId = widget->window()->id();
|
||||
std::string widgetId = widget->id();
|
||||
|
||||
return get_config_string(("layout:"+rootId).c_str(), widgetId.c_str(), "");
|
||||
return get_config_string(("layout:"+windowId).c_str(), widgetId.c_str(), "");
|
||||
}
|
||||
|
||||
void CustomizedGuiManager::saveLayout(Widget* widget, const std::string& str)
|
||||
{
|
||||
if (widget->getRoot() == NULL)
|
||||
if (widget->window() == NULL)
|
||||
return;
|
||||
|
||||
std::string rootId = widget->getRoot()->getId();
|
||||
std::string widgetId = widget->getId();
|
||||
std::string windowId = widget->window()->id();
|
||||
std::string widgetId = widget->id();
|
||||
|
||||
set_config_string(("layout:"+rootId).c_str(), widgetId.c_str(), str.c_str());
|
||||
set_config_string(("layout:"+windowId).c_str(),
|
||||
widgetId.c_str(),
|
||||
str.c_str());
|
||||
}
|
||||
|
||||
} // namespace app
|
||||
|
@ -72,13 +72,12 @@ void ResourcesLoader::threadLoadResources()
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
FileItemList list = item->getChildren();
|
||||
for (FileItemList::iterator it=list.begin(), end=list.end();
|
||||
it != end; ++it) {
|
||||
FileItemList list = item->children();
|
||||
for (auto child : list) {
|
||||
if (m_cancel)
|
||||
break;
|
||||
|
||||
Resource* resource = m_delegate->loadResource((*it)->getFileName());
|
||||
Resource* resource = m_delegate->loadResource((child)->fileName());
|
||||
if (resource)
|
||||
m_queue.push(resource);
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ void ThumbnailGenerator::addWorkerToGenerateThumbnail(IFileItem* fileitem)
|
||||
base::UniquePtr<FileOp> fop(
|
||||
FileOp::createLoadDocumentOperation(
|
||||
nullptr,
|
||||
fileitem->getFileName().c_str(),
|
||||
fileitem->fileName().c_str(),
|
||||
FILE_LOAD_SEQUENCE_NONE |
|
||||
FILE_LOAD_ONE_FRAME));
|
||||
if (!fop)
|
||||
|
@ -65,7 +65,7 @@ enum AniAction {
|
||||
AniControls::AniControls()
|
||||
: ButtonSet(5)
|
||||
{
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->getTheme());
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
|
||||
addItem(theme->parts.aniFirst());
|
||||
addItem(theme->parts.aniPrevious());
|
||||
@ -86,7 +86,7 @@ AniControls::AniControls()
|
||||
|
||||
void AniControls::updateUsingEditor(Editor* editor)
|
||||
{
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->getTheme());
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
getItem(ACTION_PLAY)->setIcon(
|
||||
(editor && editor->isPlaying() ?
|
||||
theme->parts.aniStop():
|
||||
|
@ -91,17 +91,17 @@ void AppMenuItem::onSizeHint(SizeHintEvent& ev)
|
||||
|
||||
if (hasText()) {
|
||||
size.w =
|
||||
+ getTextWidth()
|
||||
+ (inBar() ? this->childSpacing()/4: this->childSpacing())
|
||||
+ textWidth()
|
||||
+ (inBar() ? childSpacing()/4: childSpacing())
|
||||
+ border().width();
|
||||
|
||||
size.h =
|
||||
+ getTextHeight()
|
||||
+ textHeight()
|
||||
+ border().height();
|
||||
|
||||
if (m_key && !m_key->accels().empty()) {
|
||||
size.w += Graphics::measureUIStringLength(
|
||||
m_key->accels().front().toString().c_str(), getFont());
|
||||
m_key->accels().front().toString().c_str(), font());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace app {
|
||||
public:
|
||||
AppMenuItem(const char* text, Command* command = nullptr, const Params& params = Params());
|
||||
|
||||
Key* getKey() { return m_key; }
|
||||
Key* key() { return m_key; }
|
||||
void setKey(Key* key) { m_key = key; }
|
||||
|
||||
Command* getCommand() { return m_command; }
|
||||
|
@ -58,20 +58,20 @@ void ButtonSet::Item::setIcon(const SkinPartPtr& icon)
|
||||
|
||||
ButtonSet* ButtonSet::Item::buttonSet()
|
||||
{
|
||||
return static_cast<ButtonSet*>(getParent());
|
||||
return static_cast<ButtonSet*>(parent());
|
||||
}
|
||||
|
||||
void ButtonSet::Item::onPaint(ui::PaintEvent& ev)
|
||||
{
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
Graphics* g = ev.getGraphics();
|
||||
gfx::Rect rc = getClientBounds();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
Graphics* g = ev.graphics();
|
||||
gfx::Rect rc = clientBounds();
|
||||
gfx::Color fg, bg;
|
||||
SkinPartPtr nw;
|
||||
gfx::Rect boxRc, textRc, iconRc;
|
||||
gfx::Size iconSize;
|
||||
if (m_icon)
|
||||
iconSize = m_icon->getSize();
|
||||
iconSize = m_icon->size();
|
||||
|
||||
getTextIconInfo(
|
||||
&boxRc, &textRc, &iconRc,
|
||||
@ -87,8 +87,8 @@ void ButtonSet::Item::onPaint(ui::PaintEvent& ev)
|
||||
iconRc.y -= 1*guiscale();
|
||||
}
|
||||
|
||||
if (!gfx::is_transparent(getBgColor()))
|
||||
g->fillRect(getBgColor(), g->getClipBounds());
|
||||
if (!gfx::is_transparent(bgColor()))
|
||||
g->fillRect(bgColor(), g->getClipBounds());
|
||||
|
||||
if (isSelected() || hasMouseOver()) {
|
||||
if (hasCapture()) {
|
||||
@ -124,15 +124,15 @@ void ButtonSet::Item::onPaint(ui::PaintEvent& ev)
|
||||
|
||||
if (m_icon) {
|
||||
if (isSelected() && hasCapture())
|
||||
g->drawColoredRgbaSurface(m_icon->getBitmap(0), theme->colors.buttonSelectedText(),
|
||||
g->drawColoredRgbaSurface(m_icon->bitmap(0), theme->colors.buttonSelectedText(),
|
||||
iconRc.x, iconRc.y);
|
||||
else
|
||||
g->drawRgbaSurface(m_icon->getBitmap(0), iconRc.x, iconRc.y);
|
||||
g->drawRgbaSurface(m_icon->bitmap(0), iconRc.x, iconRc.y);
|
||||
}
|
||||
|
||||
if (hasText()) {
|
||||
g->setFont(getFont());
|
||||
g->drawUIString(getText(), fg, gfx::ColorNone, textRc.getOrigin(),
|
||||
g->setFont(font());
|
||||
g->drawUIString(text(), fg, gfx::ColorNone, textRc.origin(),
|
||||
false);
|
||||
}
|
||||
}
|
||||
@ -154,8 +154,8 @@ bool ButtonSet::Item::onProcessMessage(ui::Message* msg)
|
||||
KeyMessage* keymsg = static_cast<KeyMessage*>(msg);
|
||||
bool mnemonicPressed =
|
||||
(msg->altPressed() &&
|
||||
getMnemonicChar() &&
|
||||
getMnemonicChar() == tolower(keymsg->unicodeChar()));
|
||||
mnemonicChar() &&
|
||||
mnemonicChar() == tolower(keymsg->unicodeChar()));
|
||||
|
||||
if (mnemonicPressed ||
|
||||
(hasFocus() && keymsg->scancode() == kKeySpace)) {
|
||||
@ -210,7 +210,7 @@ void ButtonSet::Item::onSizeHint(ui::SizeHintEvent& ev)
|
||||
{
|
||||
gfx::Size iconSize;
|
||||
if (m_icon) {
|
||||
iconSize = m_icon->getSize();
|
||||
iconSize = m_icon->size();
|
||||
iconSize.w = MAX(iconSize.w, 16*guiscale());
|
||||
iconSize.h = MAX(iconSize.h, 16*guiscale());
|
||||
}
|
||||
@ -221,7 +221,7 @@ void ButtonSet::Item::onSizeHint(ui::SizeHintEvent& ev)
|
||||
CENTER | (hasText() ? BOTTOM: MIDDLE),
|
||||
iconSize.w, iconSize.h);
|
||||
|
||||
gfx::Size sz = boxRc.getSize();
|
||||
gfx::Size sz = boxRc.size();
|
||||
if (hasText())
|
||||
sz += 8*guiscale();
|
||||
|
||||
|
@ -93,7 +93,7 @@ protected:
|
||||
// if (isEnabled())
|
||||
StyledButton::onPaint(ev);
|
||||
// else
|
||||
// ev.getGraphics()->fillRect(getBgColor(), getClientBounds());
|
||||
// ev.graphics()->fillRect(getBgColor(), clientBounds());
|
||||
}
|
||||
};
|
||||
|
||||
@ -102,22 +102,22 @@ protected:
|
||||
|
||||
ColorBar::ScrollableView::ScrollableView()
|
||||
{
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
int l = theme->parts.editorSelected()->getBitmapW()->width();
|
||||
int t = theme->parts.editorSelected()->getBitmapN()->height();
|
||||
int r = theme->parts.editorSelected()->getBitmapE()->width();
|
||||
int b = theme->parts.editorSelected()->getBitmapS()->height();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
int l = theme->parts.editorSelected()->bitmapW()->width();
|
||||
int t = theme->parts.editorSelected()->bitmapN()->height();
|
||||
int r = theme->parts.editorSelected()->bitmapE()->width();
|
||||
int b = theme->parts.editorSelected()->bitmapS()->height();
|
||||
|
||||
setBorder(gfx::Border(l, t, r, b));
|
||||
}
|
||||
|
||||
void ColorBar::ScrollableView::onPaint(ui::PaintEvent& ev)
|
||||
{
|
||||
ui::Graphics* g = ev.getGraphics();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
ui::Graphics* g = ev.graphics();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
|
||||
theme->drawRect(
|
||||
g, getClientBounds(),
|
||||
g, clientBounds(),
|
||||
(hasFocus() ? theme->parts.editorSelected().get():
|
||||
theme->parts.editorNormal().get()),
|
||||
gfx::ColorNone);
|
||||
@ -149,7 +149,7 @@ ColorBar::ColorBar(int align)
|
||||
{
|
||||
m_instance = this;
|
||||
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
|
||||
setBorder(gfx::Border(2*guiscale(), 0, 0, 0));
|
||||
setChildSpacing(2*guiscale());
|
||||
@ -160,10 +160,10 @@ ColorBar::ColorBar(int align)
|
||||
|
||||
// TODO hardcoded scroll bar width should be get from skin.xml file
|
||||
int scrollBarWidth = 6*guiscale();
|
||||
m_scrollableView.getHorizontalBar()->setBarWidth(scrollBarWidth);
|
||||
m_scrollableView.getVerticalBar()->setBarWidth(scrollBarWidth);
|
||||
setup_mini_look(m_scrollableView.getHorizontalBar());
|
||||
setup_mini_look(m_scrollableView.getVerticalBar());
|
||||
m_scrollableView.horizontalBar()->setBarWidth(scrollBarWidth);
|
||||
m_scrollableView.verticalBar()->setBarWidth(scrollBarWidth);
|
||||
setup_mini_look(m_scrollableView.horizontalBar());
|
||||
setup_mini_look(m_scrollableView.verticalBar());
|
||||
|
||||
m_scrollableView.attachToView(&m_paletteView);
|
||||
m_scrollableView.setExpansive(true);
|
||||
@ -410,7 +410,7 @@ void ColorBar::onPaletteButtonClick()
|
||||
}
|
||||
|
||||
case PalButton::SORT: {
|
||||
gfx::Rect bounds = m_buttons.getItem(item)->getBounds();
|
||||
gfx::Rect bounds = m_buttons.getItem(item)->bounds();
|
||||
|
||||
Menu menu;
|
||||
MenuItem
|
||||
@ -474,7 +474,7 @@ void ColorBar::onPaletteButtonClick()
|
||||
}
|
||||
|
||||
if (!m_palettePopup->isVisible()) {
|
||||
gfx::Rect bounds = m_buttons.getItem(item)->getBounds();
|
||||
gfx::Rect bounds = m_buttons.getItem(item)->bounds();
|
||||
|
||||
m_palettePopup->showPopup(
|
||||
gfx::Rect(bounds.x, bounds.y+bounds.h,
|
||||
@ -489,7 +489,7 @@ void ColorBar::onPaletteButtonClick()
|
||||
case PalButton::OPTIONS: {
|
||||
Menu* menu = AppMenus::instance()->getPalettePopupMenu();
|
||||
if (menu) {
|
||||
gfx::Rect bounds = m_buttons.getItem(item)->getBounds();
|
||||
gfx::Rect bounds = m_buttons.getItem(item)->bounds();
|
||||
|
||||
menu->showPopup(gfx::Point(bounds.x, bounds.y+bounds.h));
|
||||
}
|
||||
@ -629,7 +629,7 @@ void ColorBar::setPalette(const doc::Palette* newPalette, const std::string& act
|
||||
}
|
||||
|
||||
set_current_palette(newPalette, false);
|
||||
getManager()->invalidate();
|
||||
manager()->invalidate();
|
||||
}
|
||||
|
||||
void ColorBar::setTransparentIndex(int index)
|
||||
@ -1005,7 +1005,7 @@ void ColorBar::onFixWarningClick(ColorButton* colorButton, ui::Button* warningIc
|
||||
ui::Manager::getDefault()->invalidate();
|
||||
|
||||
warningIcon->setVisible(false);
|
||||
warningIcon->getParent()->layout();
|
||||
warningIcon->parent()->layout();
|
||||
}
|
||||
catch (base::Exception& e) {
|
||||
Console::showException(e);
|
||||
@ -1033,7 +1033,7 @@ void ColorBar::updateWarningIcon(const app::Color& color, ui::Button* warningIco
|
||||
}
|
||||
|
||||
warningIcon->setVisible(index < 0);
|
||||
warningIcon->getParent()->layout();
|
||||
warningIcon->parent()->layout();
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -113,7 +113,7 @@ bool ColorButton::onProcessMessage(Message* msg)
|
||||
case kMouseMoveMessage:
|
||||
if (hasCapture()) {
|
||||
gfx::Point mousePos = static_cast<MouseMessage*>(msg)->position();
|
||||
Widget* picked = getManager()->pick(mousePos);
|
||||
Widget* picked = manager()->pick(mousePos);
|
||||
app::Color color = m_color;
|
||||
|
||||
if (picked && picked != this) {
|
||||
@ -170,11 +170,11 @@ void ColorButton::onSizeHint(SizeHintEvent& ev)
|
||||
|
||||
void ColorButton::onPaint(PaintEvent& ev)
|
||||
{
|
||||
Graphics* g = ev.getGraphics();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
gfx::Rect rc = getClientBounds();
|
||||
Graphics* g = ev.graphics();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
gfx::Rect rc = clientBounds();
|
||||
|
||||
gfx::Color bg = getBgColor();
|
||||
gfx::Color bg = bgColor();
|
||||
if (gfx::is_transparent(bg))
|
||||
bg = theme->colors.face();
|
||||
g->fillRect(bg, rc);
|
||||
@ -222,9 +222,9 @@ void ColorButton::onPaint(PaintEvent& ev)
|
||||
textcolor = color_utils::blackandwhite_neg(
|
||||
gfx::rgba(color.getRed(), color.getGreen(), color.getBlue()));
|
||||
|
||||
gfx::Rect text;
|
||||
getTextIconInfo(NULL, &text);
|
||||
g->drawUIString(getText(), textcolor, gfx::ColorNone, text.getOrigin());
|
||||
gfx::Rect textrc;
|
||||
getTextIconInfo(NULL, &textrc);
|
||||
g->drawUIString(text(), textcolor, gfx::ColorNone, textrc.origin());
|
||||
}
|
||||
|
||||
void ColorButton::onClick(Event& ev)
|
||||
@ -254,19 +254,19 @@ void ColorButton::openSelectorDialog()
|
||||
m_window->setColor(m_color, ColorSelector::ChangeType);
|
||||
m_window->openWindow();
|
||||
|
||||
x = MID(0, getBounds().x, ui::display_w()-m_window->getBounds().w);
|
||||
if (getBounds().y2() <= ui::display_h()-m_window->getBounds().h)
|
||||
y = MAX(0, getBounds().y2());
|
||||
x = MID(0, bounds().x, ui::display_w()-m_window->bounds().w);
|
||||
if (bounds().y2() <= ui::display_h()-m_window->bounds().h)
|
||||
y = MAX(0, bounds().y2());
|
||||
else
|
||||
y = MAX(0, getBounds().y-m_window->getBounds().h);
|
||||
y = MAX(0, bounds().y-m_window->bounds().h);
|
||||
|
||||
m_window->positionWindow(x, y);
|
||||
|
||||
m_window->getManager()->dispatchMessages();
|
||||
m_window->manager()->dispatchMessages();
|
||||
m_window->layout();
|
||||
|
||||
// Setup the hot-region
|
||||
gfx::Rect rc = getBounds().createUnion(m_window->getBounds());
|
||||
gfx::Rect rc = bounds().createUnion(m_window->bounds());
|
||||
rc.enlarge(8);
|
||||
gfx::Region rgn(rc);
|
||||
static_cast<PopupWindow*>(m_window)->setHotRegion(rgn);
|
||||
|
@ -107,7 +107,7 @@ ColorSelector::ColorSelector()
|
||||
|
||||
ColorSelector::~ColorSelector()
|
||||
{
|
||||
getPin()->getParent()->removeChild(getPin());
|
||||
getPin()->parent()->removeChild(getPin());
|
||||
}
|
||||
|
||||
void ColorSelector::setColor(const app::Color& color, SetColorOptions options)
|
||||
|
@ -192,7 +192,7 @@ void ColorSliders::onSliderChange(int i)
|
||||
void ColorSliders::onEntryChange(int i)
|
||||
{
|
||||
// Update the slider related to the changed entry widget.
|
||||
int value = m_entry[i]->getTextInt();
|
||||
int value = m_entry[i]->textInt();
|
||||
|
||||
Slider* slider = (m_mode == Absolute ? m_absSlider[i]: m_relSlider[i]);
|
||||
value = MID(slider->getMinValue(), value, slider->getMaxValue());
|
||||
|
@ -41,15 +41,15 @@ ColorSpectrum::~ColorSpectrum()
|
||||
|
||||
app::Color ColorSpectrum::pickColor(const gfx::Point& pos) const
|
||||
{
|
||||
gfx::Rect rc = getChildrenBounds();
|
||||
gfx::Rect rc = childrenBounds();
|
||||
if (rc.isEmpty() || !rc.contains(pos))
|
||||
return app::Color::fromMask();
|
||||
|
||||
int vmid = (getAlign() & HORIZONTAL ? rc.h/2 : rc.w/2);
|
||||
int vmid = (align() & HORIZONTAL ? rc.h/2 : rc.w/2);
|
||||
vmid = MAX(1, vmid);
|
||||
|
||||
int u, v, umax;
|
||||
if (getAlign() & HORIZONTAL) {
|
||||
if (align() & HORIZONTAL) {
|
||||
u = pos.x - rc.x;
|
||||
v = pos.y - rc.y;
|
||||
umax = MAX(1, rc.w-1);
|
||||
@ -88,24 +88,24 @@ void ColorSpectrum::onResize(ui::ResizeEvent& ev)
|
||||
|
||||
void ColorSpectrum::onPaint(ui::PaintEvent& ev)
|
||||
{
|
||||
ui::Graphics* g = ev.getGraphics();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
ui::Graphics* g = ev.graphics();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
|
||||
theme->drawRect(g, getClientBounds(),
|
||||
theme->drawRect(g, clientBounds(),
|
||||
theme->parts.editorNormal().get(),
|
||||
getBgColor());
|
||||
bgColor());
|
||||
|
||||
gfx::Rect rc = getClientChildrenBounds();
|
||||
gfx::Rect rc = clientChildrenBounds();
|
||||
if (rc.isEmpty())
|
||||
return;
|
||||
|
||||
int vmid = (getAlign() & HORIZONTAL ? rc.h/2 : rc.w/2);
|
||||
int vmid = (align() & HORIZONTAL ? rc.h/2 : rc.w/2);
|
||||
vmid = MAX(1, vmid);
|
||||
|
||||
for (int y=0; y<rc.h; ++y) {
|
||||
for (int x=0; x<rc.w; ++x) {
|
||||
int u, v, umax;
|
||||
if (getAlign() & HORIZONTAL) {
|
||||
if (align() & HORIZONTAL) {
|
||||
u = x;
|
||||
v = y;
|
||||
umax = MAX(1, rc.w-1);
|
||||
@ -138,7 +138,7 @@ void ColorSpectrum::onPaint(ui::PaintEvent& ev)
|
||||
gfx::Point pos(rc.x + hue * rc.w / 360,
|
||||
rc.y + rc.h - (lit * rc.h / 100));
|
||||
|
||||
she::Surface* icon = theme->parts.colorWheelIndicator()->getBitmap(0);
|
||||
she::Surface* icon = theme->parts.colorWheelIndicator()->bitmap(0);
|
||||
g->drawRgbaSurface(icon,
|
||||
pos.x-icon->width()/2,
|
||||
pos.y-icon->height()/2);
|
||||
@ -173,7 +173,7 @@ bool ColorSpectrum::onProcessMessage(ui::Message* msg)
|
||||
|
||||
case kSetCursorMessage: {
|
||||
MouseMessage* mouseMsg = static_cast<MouseMessage*>(msg);
|
||||
if (getChildrenBounds().contains(mouseMsg->position())) {
|
||||
if (childrenBounds().contains(mouseMsg->position())) {
|
||||
ui::set_mouse_cursor(kEyedropperCursor);
|
||||
return true;
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ void ColorWheel::onResize(ui::ResizeEvent& ev)
|
||||
{
|
||||
Widget::onResize(ev);
|
||||
|
||||
gfx::Rect rc = getClientChildrenBounds();
|
||||
gfx::Rect rc = clientChildrenBounds();
|
||||
int r = MIN(rc.w/2, rc.h/2);
|
||||
|
||||
m_clientBounds = rc;
|
||||
@ -197,7 +197,7 @@ void ColorWheel::onResize(ui::ResizeEvent& ev)
|
||||
r*2, r*2);
|
||||
|
||||
gfx::Size prefSize = m_options.sizeHint();
|
||||
rc = getChildrenBounds();
|
||||
rc = childrenBounds();
|
||||
rc.x += rc.w-prefSize.w;
|
||||
rc.w = prefSize.w;
|
||||
rc.h = prefSize.h;
|
||||
@ -206,12 +206,12 @@ void ColorWheel::onResize(ui::ResizeEvent& ev)
|
||||
|
||||
void ColorWheel::onPaint(ui::PaintEvent& ev)
|
||||
{
|
||||
ui::Graphics* g = ev.getGraphics();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
ui::Graphics* g = ev.graphics();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
|
||||
theme->drawRect(g, getClientBounds(),
|
||||
theme->drawRect(g, clientBounds(),
|
||||
theme->parts.editorNormal().get(),
|
||||
getBgColor());
|
||||
bgColor());
|
||||
|
||||
const gfx::Rect& rc = m_clientBounds;
|
||||
|
||||
@ -241,11 +241,11 @@ void ColorWheel::onPaint(ui::PaintEvent& ev)
|
||||
int hue = color.getHue()-30;
|
||||
int sat = color.getSaturation();
|
||||
gfx::Point pos =
|
||||
m_wheelBounds.getCenter() +
|
||||
m_wheelBounds.center() +
|
||||
gfx::Point(int(+std::cos(PI*hue/180)*double(m_wheelRadius)*sat/100.0),
|
||||
int(-std::sin(PI*hue/180)*double(m_wheelRadius)*sat/100.0));
|
||||
|
||||
she::Surface* icon = theme->parts.colorWheelIndicator()->getBitmap(0);
|
||||
she::Surface* icon = theme->parts.colorWheelIndicator()->bitmap(0);
|
||||
g->drawRgbaSurface(icon,
|
||||
pos.x-icon->width()/2,
|
||||
pos.y-icon->height()/2);
|
||||
@ -273,7 +273,7 @@ bool ColorWheel::onProcessMessage(ui::Message* msg)
|
||||
|
||||
app::Color color = pickColor(
|
||||
mouseMsg->position()
|
||||
- getBounds().getOrigin());
|
||||
- bounds().origin());
|
||||
|
||||
if (color != app::Color::fromMask()) {
|
||||
base::ScopedValue<bool> switcher(m_lockColor, m_harmonyPicked, false);
|
||||
@ -295,7 +295,7 @@ bool ColorWheel::onProcessMessage(ui::Message* msg)
|
||||
MouseMessage* mouseMsg = static_cast<MouseMessage*>(msg);
|
||||
app::Color color = pickColor(
|
||||
mouseMsg->position()
|
||||
- getBounds().getOrigin());
|
||||
- bounds().origin());
|
||||
|
||||
if (color.getType() != app::Color::MaskType) {
|
||||
ui::set_mouse_cursor(kEyedropperCursor);
|
||||
@ -354,7 +354,7 @@ void ColorWheel::onOptions()
|
||||
tetradic.Click.connect(Bind<void>(&ColorWheel::setHarmony, this, Harmony::TETRADIC));
|
||||
square.Click.connect(Bind<void>(&ColorWheel::setHarmony, this, Harmony::SQUARE));
|
||||
|
||||
gfx::Rect rc = m_options.getBounds();
|
||||
gfx::Rect rc = m_options.bounds();
|
||||
menu.showPopup(gfx::Point(rc.x+rc.w, rc.y));
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ private:
|
||||
// Returns a little rectangle that can be used by the popup as the
|
||||
// first brush position.
|
||||
gfx::Rect getPopupBox() {
|
||||
Rect rc = getBounds();
|
||||
Rect rc = bounds();
|
||||
rc.y += rc.h - 2*guiscale();
|
||||
rc.setSize(sizeHint());
|
||||
return rc;
|
||||
@ -154,7 +154,7 @@ private:
|
||||
m_popupWindow.regenerate(getPopupBox(), m_owner->getBrushes());
|
||||
m_popupWindow.setBrush(brush.get());
|
||||
|
||||
Region rgn(m_popupWindow.getBounds().createUnion(getBounds()));
|
||||
Region rgn(m_popupWindow.bounds().createUnion(bounds()));
|
||||
m_popupWindow.setHotRegion(rgn);
|
||||
|
||||
m_popupWindow.openWindow();
|
||||
@ -375,7 +375,7 @@ protected:
|
||||
void onItemChange(Item* item) override {
|
||||
ButtonSet::onItemChange(item);
|
||||
|
||||
gfx::Rect bounds = getBounds();
|
||||
gfx::Rect bounds = this->bounds();
|
||||
|
||||
AppMenus::instance()
|
||||
->getInkPopupMenu()
|
||||
@ -460,7 +460,7 @@ class ContextBar::InkShadesField : public HBox {
|
||||
void setShade(const Shade& shade) {
|
||||
m_shade = shade;
|
||||
invalidate();
|
||||
getParent()->getParent()->layout();
|
||||
parent()->parent()->layout();
|
||||
}
|
||||
|
||||
private:
|
||||
@ -481,7 +481,7 @@ class ContextBar::InkShadesField : public HBox {
|
||||
++i;
|
||||
}
|
||||
|
||||
getParent()->getParent()->layout();
|
||||
parent()->parent()->layout();
|
||||
}
|
||||
|
||||
bool onProcessMessage(ui::Message* msg) override {
|
||||
@ -535,7 +535,7 @@ class ContextBar::InkShadesField : public HBox {
|
||||
|
||||
// Relayout the context bar if we have removed an entry.
|
||||
if (m_hotIndex < 0)
|
||||
getParent()->getParent()->layout();
|
||||
parent()->parent()->layout();
|
||||
}
|
||||
|
||||
if (hasCapture())
|
||||
@ -545,8 +545,8 @@ class ContextBar::InkShadesField : public HBox {
|
||||
|
||||
case kMouseMoveMessage: {
|
||||
MouseMessage* mouseMsg = static_cast<MouseMessage*>(msg);
|
||||
gfx::Point mousePos = mouseMsg->position() - getBounds().getOrigin();
|
||||
gfx::Rect bounds = getClientBounds();
|
||||
gfx::Point mousePos = mouseMsg->position() - bounds().origin();
|
||||
gfx::Rect bounds = clientBounds();
|
||||
int hot = -1;
|
||||
|
||||
bounds.shrink(3*guiscale());
|
||||
@ -577,7 +577,7 @@ class ContextBar::InkShadesField : public HBox {
|
||||
void onSizeHint(SizeHintEvent& ev) override {
|
||||
int size = this->size();
|
||||
if (size < 2)
|
||||
ev.setSizeHint(Size((16+m_boxSize)*guiscale()+getTextWidth(), 18*guiscale()));
|
||||
ev.setSizeHint(Size((16+m_boxSize)*guiscale()+textWidth(), 18*guiscale()));
|
||||
else {
|
||||
if (m_click == Select && size > 16)
|
||||
size = 16;
|
||||
@ -587,10 +587,10 @@ class ContextBar::InkShadesField : public HBox {
|
||||
|
||||
void onPaint(PaintEvent& ev) override {
|
||||
SkinTheme* theme = SkinTheme::instance();
|
||||
Graphics* g = ev.getGraphics();
|
||||
gfx::Rect bounds = getClientBounds();
|
||||
Graphics* g = ev.graphics();
|
||||
gfx::Rect bounds = clientBounds();
|
||||
|
||||
gfx::Color bg = getBgColor();
|
||||
gfx::Color bg = bgColor();
|
||||
if (m_click == Select && hasMouseOver())
|
||||
bg = theme->colors.menuitemHighlightFace();
|
||||
g->fillRect(bg, bounds);
|
||||
@ -653,7 +653,7 @@ class ContextBar::InkShadesField : public HBox {
|
||||
}
|
||||
else {
|
||||
g->fillRect(theme->colors.editorFace(), bounds);
|
||||
g->drawAlignedUIString(getText(), theme->colors.face(), gfx::ColorNone, bounds,
|
||||
g->drawAlignedUIString(text(), theme->colors.face(), gfx::ColorNone, bounds,
|
||||
ui::CENTER | ui::MIDDLE);
|
||||
}
|
||||
}
|
||||
@ -669,7 +669,7 @@ class ContextBar::InkShadesField : public HBox {
|
||||
|
||||
public:
|
||||
InkShadesField()
|
||||
: m_button(SkinTheme::instance()->parts.iconArrowDown()->getBitmap(0))
|
||||
: m_button(SkinTheme::instance()->parts.iconArrowDown()->bitmap(0))
|
||||
, m_shade(Shade(), ShadeWidget::DragAndDrop)
|
||||
, m_loaded(false) {
|
||||
SkinTheme* theme = SkinTheme::instance();
|
||||
@ -699,7 +699,7 @@ public:
|
||||
private:
|
||||
void onShowMenu() {
|
||||
loadShades();
|
||||
gfx::Rect bounds = m_button.getBounds();
|
||||
gfx::Rect bounds = m_button.bounds();
|
||||
|
||||
Menu menu;
|
||||
MenuItem
|
||||
@ -729,7 +729,7 @@ private:
|
||||
m_shade.setShade(shade);
|
||||
});
|
||||
|
||||
auto close = new IconButton(theme->parts.iconClose()->getBitmap(0));
|
||||
auto close = new IconButton(theme->parts.iconClose()->bitmap(0));
|
||||
close->setBgColor(theme->colors.menuitemNormalFace());
|
||||
close->Click.connect(
|
||||
Bind<void>(
|
||||
@ -882,7 +882,7 @@ public:
|
||||
private:
|
||||
|
||||
void onPopup() {
|
||||
gfx::Rect bounds = getBounds();
|
||||
gfx::Rect bounds = this->bounds();
|
||||
|
||||
Menu menu;
|
||||
MenuItem
|
||||
@ -962,8 +962,8 @@ private:
|
||||
void onItemChange(Item* item) override {
|
||||
ButtonSet::onItemChange(item);
|
||||
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
gfx::Rect bounds = getBounds();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
gfx::Rect bounds = this->bounds();
|
||||
|
||||
Menu menu;
|
||||
CheckBox visible("Display pivot by default");
|
||||
@ -1111,7 +1111,7 @@ class ContextBar::SelectionModeField : public ButtonSet
|
||||
{
|
||||
public:
|
||||
SelectionModeField() : ButtonSet(3) {
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
|
||||
addItem(theme->parts.selectionReplace());
|
||||
addItem(theme->parts.selectionAdd());
|
||||
@ -1144,7 +1144,7 @@ class ContextBar::DropPixelsField : public ButtonSet
|
||||
{
|
||||
public:
|
||||
DropPixelsField() : ButtonSet(2) {
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
|
||||
addItem(theme->parts.dropPixelsOk());
|
||||
addItem(theme->parts.dropPixelsCancel());
|
||||
@ -1283,7 +1283,7 @@ ContextBar::ContextBar()
|
||||
border.bottom(2*guiscale());
|
||||
setBorder(border);
|
||||
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
setBgColor(theme->colors.workspace());
|
||||
|
||||
addChild(m_selectionOptionsBox = new HBox());
|
||||
@ -1608,7 +1608,7 @@ void ContextBar::updateForMovingPixels()
|
||||
|
||||
void ContextBar::updateForSelectingBox(const std::string& text)
|
||||
{
|
||||
if (m_selectBoxHelp->isVisible() && m_selectBoxHelp->getText() == text)
|
||||
if (m_selectBoxHelp->isVisible() && m_selectBoxHelp->text() == text)
|
||||
return;
|
||||
|
||||
updateForTool(nullptr);
|
||||
|
@ -67,7 +67,7 @@ protected:
|
||||
void onResize(ResizeEvent& ev) override {
|
||||
ListItem::onResize(ev);
|
||||
|
||||
gfx::Rect rc = ev.getBounds();
|
||||
gfx::Rect rc = ev.bounds();
|
||||
gfx::Size sz1 = m_openButton.sizeHint();
|
||||
sz1.w *= 2*guiscale();
|
||||
gfx::Size sz2 = m_deleteButton.sizeHint();
|
||||
@ -86,7 +86,7 @@ protected:
|
||||
}
|
||||
|
||||
void onDelete() {
|
||||
Widget* parent = getParent();
|
||||
Widget* parent = this->parent();
|
||||
|
||||
if (m_backup) {
|
||||
// Delete one backup
|
||||
@ -97,7 +97,7 @@ protected:
|
||||
|
||||
m_session->deleteBackup(m_backup);
|
||||
|
||||
Widget* parent = getParent();
|
||||
Widget* parent = this->parent(); // TODO remove this line
|
||||
parent->removeChild(this);
|
||||
deferDelete();
|
||||
}
|
||||
@ -136,7 +136,7 @@ DataRecoveryView::DataRecoveryView(crash::DataRecovery* dataRecovery)
|
||||
: Box(VERTICAL)
|
||||
, m_dataRecovery(dataRecovery)
|
||||
{
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
setBgColor(theme->colors.workspace());
|
||||
|
||||
addChild(&m_view);
|
||||
|
@ -46,7 +46,7 @@ protected:
|
||||
switch (scancode) {
|
||||
case kKeyEnter:
|
||||
case kKeyEnterPad: {
|
||||
std::string cmd = getText();
|
||||
std::string cmd = text();
|
||||
ExecuteCommand(cmd);
|
||||
setText("");
|
||||
return true;
|
||||
@ -66,7 +66,7 @@ DevConsoleView::DevConsoleView()
|
||||
, m_entry(new CommmandEntry)
|
||||
, m_engine(this)
|
||||
{
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
|
||||
addChild(&m_view);
|
||||
addChild(&m_bottomBox);
|
||||
@ -137,7 +137,7 @@ void DevConsoleView::onExecuteCommand(const std::string& cmd)
|
||||
void DevConsoleView::onConsolePrint(const char* text)
|
||||
{
|
||||
if (text)
|
||||
m_textBox.setText(m_textBox.getText() + "\n" + text);
|
||||
m_textBox.setText(m_textBox.text() + "\n" + text);
|
||||
}
|
||||
|
||||
} // namespace app
|
||||
|
@ -232,7 +232,7 @@ void DocumentView::onClonedFrom(WorkspaceView* from)
|
||||
newEditor->setZoom(srcEditor->zoom());
|
||||
|
||||
View::getView(newEditor)
|
||||
->setViewScroll(View::getView(srcEditor)->getViewScroll());
|
||||
->setViewScroll(View::getView(srcEditor)->viewScroll());
|
||||
}
|
||||
|
||||
bool DocumentView::onCloseView(Workspace* workspace)
|
||||
|
@ -184,7 +184,7 @@ void BrushPreview::show(const gfx::Point& screenPos)
|
||||
base::UniquePtr<tools::ToolLoop> loop(
|
||||
create_tool_loop_preview(
|
||||
m_editor, extraImage,
|
||||
brushBounds.getOrigin()));
|
||||
brushBounds.origin()));
|
||||
if (loop) {
|
||||
loop->getInk()->prepareInk(loop);
|
||||
loop->getIntertwine()->prepareIntertwine();
|
||||
|
@ -113,7 +113,7 @@ public:
|
||||
gfx::Point b(x2, y2);
|
||||
a = m_editor->editorToScreen(a);
|
||||
b = m_editor->editorToScreen(b);
|
||||
gfx::Rect bounds = m_editor->getBounds();
|
||||
gfx::Rect bounds = m_editor->bounds();
|
||||
a.x -= bounds.x;
|
||||
a.y -= bounds.y;
|
||||
b.x -= bounds.x;
|
||||
@ -123,7 +123,7 @@ public:
|
||||
|
||||
void drawRectXor(const gfx::Rect& rc) override {
|
||||
gfx::Rect rc2 = m_editor->editorToScreen(rc);
|
||||
gfx::Rect bounds = m_editor->getBounds();
|
||||
gfx::Rect bounds = m_editor->bounds();
|
||||
rc2.x -= bounds.x;
|
||||
rc2.y -= bounds.y;
|
||||
|
||||
@ -347,7 +347,7 @@ Site Editor::getSite() const
|
||||
void Editor::setDefaultScroll()
|
||||
{
|
||||
View* view = View::getView(this);
|
||||
Rect vp = view->getViewportBounds();
|
||||
Rect vp = view->viewportBounds();
|
||||
|
||||
setEditorScroll(
|
||||
gfx::Point(
|
||||
@ -365,11 +365,11 @@ void Editor::setEditorScroll(const gfx::Point& scroll, bool blitValidRegion)
|
||||
|
||||
if (blitValidRegion) {
|
||||
getDrawableRegion(region, kCutTopWindows);
|
||||
oldScroll = view->getViewScroll();
|
||||
oldScroll = view->viewScroll();
|
||||
}
|
||||
|
||||
view->setViewScroll(scroll);
|
||||
Point newScroll = view->getViewScroll();
|
||||
Point newScroll = view->viewScroll();
|
||||
|
||||
if (blitValidRegion) {
|
||||
// Move screen with blits
|
||||
@ -538,7 +538,7 @@ void Editor::drawSpriteUnclippedRect(ui::Graphics* g, const gfx::Rect& _rc)
|
||||
if (m_zoom.scale() < 1.0)
|
||||
rc.inflate(int(1./m_zoom.scale()), int(1./m_zoom.scale()));
|
||||
|
||||
gfx::Rect client = getClientBounds();
|
||||
gfx::Rect client = clientBounds();
|
||||
gfx::Rect spriteRect(
|
||||
client.x + m_padding.x,
|
||||
client.y + m_padding.y,
|
||||
@ -586,7 +586,7 @@ void Editor::drawSpriteUnclippedRect(ui::Graphics* g, const gfx::Rect& _rc)
|
||||
|
||||
// Fill the outside (parts of the editor that aren't covered by the
|
||||
// sprite).
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->getTheme());
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
if (m_flags & kShowOutside) {
|
||||
g->fillRegion(theme->colors.editorFace(), outside);
|
||||
}
|
||||
@ -594,7 +594,7 @@ void Editor::drawSpriteUnclippedRect(ui::Graphics* g, const gfx::Rect& _rc)
|
||||
// Grids
|
||||
{
|
||||
// Clipping
|
||||
gfx::Rect cliprc = editorToScreen(rc).offset(-getBounds().getOrigin());
|
||||
gfx::Rect cliprc = editorToScreen(rc).offset(-bounds().origin());
|
||||
cliprc = cliprc.createIntersection(spriteRect);
|
||||
if (!cliprc.isEmpty()) {
|
||||
IntersectClip clip(g, cliprc);
|
||||
@ -692,7 +692,7 @@ void Editor::drawSpriteClipped(const gfx::Region& updateRegion)
|
||||
getDrawableRegion(screenRegion, kCutTopWindows);
|
||||
|
||||
ScreenGraphics screenGraphics;
|
||||
GraphicsPtr editorGraphics = getGraphics(getClientBounds());
|
||||
GraphicsPtr editorGraphics = getGraphics(clientBounds());
|
||||
|
||||
for (const Rect& updateRect : updateRegion) {
|
||||
for (const Rect& screenRect : screenRegion) {
|
||||
@ -747,10 +747,10 @@ void Editor::drawMaskSafe()
|
||||
m_document->getMaskBoundaries()) {
|
||||
Region region;
|
||||
getDrawableRegion(region, kCutTopWindows);
|
||||
region.offset(-getBounds().getOrigin());
|
||||
region.offset(-bounds().origin());
|
||||
|
||||
HideBrushPreview hide(m_brushPreview);
|
||||
GraphicsPtr g = getGraphics(getClientBounds());
|
||||
GraphicsPtr g = getGraphics(clientBounds());
|
||||
|
||||
for (const gfx::Rect& rc : region) {
|
||||
IntersectClip clip(g.get(), rc);
|
||||
@ -786,8 +786,8 @@ void Editor::drawGrid(Graphics* g, const gfx::Rect& spriteBounds, const Rect& gr
|
||||
return;
|
||||
|
||||
// Adjust for client area
|
||||
gfx::Rect bounds = getBounds();
|
||||
grid.offset(-bounds.getOrigin());
|
||||
gfx::Rect bounds = this->bounds();
|
||||
grid.offset(-bounds.origin());
|
||||
|
||||
while (grid.x-grid.w >= spriteBounds.x) grid.x -= grid.w;
|
||||
while (grid.y-grid.h >= spriteBounds.y) grid.y -= grid.h;
|
||||
@ -842,7 +842,7 @@ void Editor::flashCurrentLayer()
|
||||
m_document->setExtraCel(extraCel);
|
||||
drawSpriteClipped(gfx::Region(
|
||||
gfx::Rect(0, 0, m_sprite->width(), m_sprite->height())));
|
||||
getManager()->flipDisplay();
|
||||
manager()->flipDisplay();
|
||||
m_document->setExtraCel(oldExtraCel);
|
||||
}
|
||||
|
||||
@ -855,7 +855,7 @@ gfx::Point Editor::autoScroll(MouseMessage* msg, AutoScroll dir, bool blitValidR
|
||||
// // Hide the brush preview
|
||||
// HideBrushPreview hide(editor->brushPreview());
|
||||
View* view = View::getView(this);
|
||||
gfx::Rect vp = view->getViewportBounds();
|
||||
gfx::Rect vp = view->viewportBounds();
|
||||
gfx::Point mousePos = msg->position();
|
||||
|
||||
if (!vp.contains(mousePos)) {
|
||||
@ -872,7 +872,7 @@ gfx::Point Editor::autoScroll(MouseMessage* msg, AutoScroll dir, bool blitValidR
|
||||
delta.y = 0;
|
||||
}
|
||||
|
||||
gfx::Point scroll = view->getViewScroll();
|
||||
gfx::Point scroll = view->viewScroll();
|
||||
if (dir == AutoScroll::MouseDir) {
|
||||
scroll += delta;
|
||||
}
|
||||
@ -1013,8 +1013,8 @@ tools::Ink* Editor::getCurrentEditorInk()
|
||||
gfx::Point Editor::screenToEditor(const gfx::Point& pt)
|
||||
{
|
||||
View* view = View::getView(this);
|
||||
Rect vp = view->getViewportBounds();
|
||||
Point scroll = view->getViewScroll();
|
||||
Rect vp = view->viewportBounds();
|
||||
Point scroll = view->viewScroll();
|
||||
|
||||
return gfx::Point(
|
||||
m_zoom.remove(pt.x - vp.x + scroll.x - m_padding.x),
|
||||
@ -1024,8 +1024,8 @@ gfx::Point Editor::screenToEditor(const gfx::Point& pt)
|
||||
Point Editor::editorToScreen(const gfx::Point& pt)
|
||||
{
|
||||
View* view = View::getView(this);
|
||||
Rect vp = view->getViewportBounds();
|
||||
Point scroll = view->getViewScroll();
|
||||
Rect vp = view->viewportBounds();
|
||||
Point scroll = view->viewScroll();
|
||||
|
||||
return Point(
|
||||
(vp.x - scroll.x + m_padding.x + m_zoom.apply(pt.x)),
|
||||
@ -1035,15 +1035,15 @@ Point Editor::editorToScreen(const gfx::Point& pt)
|
||||
Rect Editor::screenToEditor(const Rect& rc)
|
||||
{
|
||||
return gfx::Rect(
|
||||
screenToEditor(rc.getOrigin()),
|
||||
screenToEditor(rc.getPoint2()));
|
||||
screenToEditor(rc.origin()),
|
||||
screenToEditor(rc.point2()));
|
||||
}
|
||||
|
||||
Rect Editor::editorToScreen(const Rect& rc)
|
||||
{
|
||||
return gfx::Rect(
|
||||
editorToScreen(rc.getOrigin()),
|
||||
editorToScreen(rc.getPoint2()));
|
||||
editorToScreen(rc.origin()),
|
||||
editorToScreen(rc.point2()));
|
||||
}
|
||||
|
||||
void Editor::addObserver(EditorObserver* observer)
|
||||
@ -1071,7 +1071,7 @@ Rect Editor::getVisibleSpriteBounds()
|
||||
if (!m_sprite) return Rect();
|
||||
|
||||
View* view = View::getView(this);
|
||||
Rect vp = view->getViewportBounds();
|
||||
Rect vp = view->viewportBounds();
|
||||
vp = screenToEditor(vp);
|
||||
|
||||
return vp.createIntersection(m_sprite->bounds());
|
||||
@ -1082,7 +1082,7 @@ void Editor::centerInSpritePoint(const gfx::Point& spritePos)
|
||||
{
|
||||
HideBrushPreview hide(m_brushPreview);
|
||||
View* view = View::getView(this);
|
||||
Rect vp = view->getViewportBounds();
|
||||
Rect vp = view->viewportBounds();
|
||||
|
||||
gfx::Point scroll(
|
||||
m_padding.x - (vp.w/2) + m_zoom.apply(1)/2 + m_zoom.apply(spritePos.x),
|
||||
@ -1349,9 +1349,9 @@ void Editor::onResize(ui::ResizeEvent& ev)
|
||||
void Editor::onPaint(ui::PaintEvent& ev)
|
||||
{
|
||||
HideBrushPreview hide(m_brushPreview);
|
||||
Graphics* g = ev.getGraphics();
|
||||
gfx::Rect rc = getClientBounds();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->getTheme());
|
||||
Graphics* g = ev.graphics();
|
||||
gfx::Rect rc = clientBounds();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
|
||||
// Editor without sprite
|
||||
if (!m_sprite) {
|
||||
@ -1379,7 +1379,7 @@ void Editor::onPaint(ui::PaintEvent& ev)
|
||||
// The sprite is locked to be read, so we can draw an opaque
|
||||
// background only.
|
||||
g->fillRect(theme->colors.editorFace(), rc);
|
||||
defer_invalid_rect(g->getClipBounds().offset(getBounds().getOrigin()));
|
||||
defer_invalid_rect(g->getClipBounds().offset(bounds().origin()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1450,7 +1450,7 @@ void Editor::setZoomAndCenterInMouse(const Zoom& zoom,
|
||||
{
|
||||
HideBrushPreview hide(m_brushPreview);
|
||||
View* view = View::getView(this);
|
||||
Rect vp = view->getViewportBounds();
|
||||
Rect vp = view->viewportBounds();
|
||||
|
||||
gfx::Point screenPos;
|
||||
gfx::Point spritePos;
|
||||
@ -1485,7 +1485,7 @@ void Editor::setZoomAndCenterInMouse(const Zoom& zoom,
|
||||
padding.x - (screenPos.x-vp.x) + zoom.apply(spritePos.x+zoom.remove(1)/2) + int(zoom.apply(subpixelPos.x)),
|
||||
padding.y - (screenPos.y-vp.y) + zoom.apply(spritePos.y+zoom.remove(1)/2) + int(zoom.apply(subpixelPos.y)));
|
||||
|
||||
if ((m_zoom != zoom) || (screenPos != view->getViewScroll())) {
|
||||
if ((m_zoom != zoom) || (screenPos != view->viewScroll())) {
|
||||
bool blitValidRegion = (m_zoom == zoom);
|
||||
|
||||
m_zoom = zoom;
|
||||
@ -1536,7 +1536,7 @@ void Editor::pasteImage(const Image* image, const Mask* mask)
|
||||
|
||||
// If the pasted image original location center point isn't
|
||||
// visible, we center the image in the editor's visible bounds.
|
||||
if (!visibleBounds.contains(mask->bounds().getCenter())) {
|
||||
if (!visibleBounds.contains(mask->bounds().center())) {
|
||||
x = visibleBounds.x + visibleBounds.w/2 - image->width()/2;
|
||||
y = visibleBounds.y + visibleBounds.h/2 - image->height()/2;
|
||||
}
|
||||
@ -1669,7 +1669,7 @@ gfx::Point Editor::calcExtraPadding(const Zoom& zoom)
|
||||
{
|
||||
View* view = View::getView(this);
|
||||
if (view) {
|
||||
Rect vp = view->getViewportBounds();
|
||||
Rect vp = view->viewportBounds();
|
||||
return gfx::Point(
|
||||
std::max<int>(vp.w/2, vp.w - zoom.apply(m_sprite->width())),
|
||||
std::max<int>(vp.h/2, vp.h - zoom.apply(m_sprite->height())));
|
||||
|
@ -40,11 +40,11 @@ EditorView::EditorView(EditorView::Type type)
|
||||
: View()
|
||||
, m_type(type)
|
||||
{
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
int l = theme->parts.editorSelected()->getBitmapW()->width();
|
||||
int t = theme->parts.editorSelected()->getBitmapN()->height();
|
||||
int r = theme->parts.editorSelected()->getBitmapE()->width();
|
||||
int b = theme->parts.editorSelected()->getBitmapS()->height();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
int l = theme->parts.editorSelected()->bitmapW()->width();
|
||||
int t = theme->parts.editorSelected()->bitmapN()->height();
|
||||
int r = theme->parts.editorSelected()->bitmapE()->width();
|
||||
int b = theme->parts.editorSelected()->bitmapS()->height();
|
||||
|
||||
setBorder(gfx::Border(l, t, r, b));
|
||||
setBgColor(gfx::rgba(0, 0, 0));
|
||||
@ -57,8 +57,8 @@ EditorView::EditorView(EditorView::Type type)
|
||||
|
||||
void EditorView::onPaint(PaintEvent& ev)
|
||||
{
|
||||
Graphics* g = ev.getGraphics();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
Graphics* g = ev.graphics();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
bool selected = false;
|
||||
|
||||
switch (m_type) {
|
||||
@ -76,11 +76,11 @@ void EditorView::onPaint(PaintEvent& ev)
|
||||
}
|
||||
|
||||
theme->drawRect(
|
||||
g, getClientBounds(),
|
||||
g, clientBounds(),
|
||||
(selected ?
|
||||
theme->parts.editorSelected().get():
|
||||
theme->parts.editorNormal().get()),
|
||||
getBgColor());
|
||||
bgColor());
|
||||
}
|
||||
|
||||
void EditorView::onResize(ResizeEvent& ev)
|
||||
@ -93,7 +93,7 @@ void EditorView::onResize(ResizeEvent& ev)
|
||||
oldPos = editor->editorToScreen(gfx::Point(0, 0));
|
||||
break;
|
||||
case KeepCenter:
|
||||
oldPos = editor->screenToEditor(getViewportBounds().getCenter());
|
||||
oldPos = editor->screenToEditor(viewportBounds().center());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -105,7 +105,7 @@ void EditorView::onResize(ResizeEvent& ev)
|
||||
case KeepOrigin: {
|
||||
// This keeps the same scroll position for the editor
|
||||
gfx::Point newPos = editor->editorToScreen(gfx::Point(0, 0));
|
||||
gfx::Point oldScroll = getViewScroll();
|
||||
gfx::Point oldScroll = viewScroll();
|
||||
editor->setEditorScroll(oldScroll + newPos - oldPos, false);
|
||||
break;
|
||||
}
|
||||
@ -133,14 +133,14 @@ void EditorView::setupScrollbars()
|
||||
hideScrollBars();
|
||||
}
|
||||
else {
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
int barsize = theme->dimensions.miniScrollbarSize();
|
||||
|
||||
getHorizontalBar()->setBarWidth(barsize);
|
||||
getVerticalBar()->setBarWidth(barsize);
|
||||
horizontalBar()->setBarWidth(barsize);
|
||||
verticalBar()->setBarWidth(barsize);
|
||||
|
||||
setup_mini_look(getHorizontalBar());
|
||||
setup_mini_look(getVerticalBar());
|
||||
setup_mini_look(horizontalBar());
|
||||
setup_mini_look(verticalBar());
|
||||
|
||||
showScrollBars();
|
||||
}
|
||||
|
@ -96,8 +96,8 @@ MovingPixelsState::MovingPixelsState(Editor* editor, MouseMessage* msg, PixelsMo
|
||||
// Add the current editor as filter for key message of the manager
|
||||
// so we can catch the Enter key, and avoid to execute the
|
||||
// PlayAnimation command.
|
||||
m_editor->getManager()->addMessageFilter(kKeyDownMessage, m_editor);
|
||||
m_editor->getManager()->addMessageFilter(kKeyUpMessage, m_editor);
|
||||
m_editor->manager()->addMessageFilter(kKeyDownMessage, m_editor);
|
||||
m_editor->manager()->addMessageFilter(kKeyUpMessage, m_editor);
|
||||
m_editor->addObserver(this);
|
||||
m_observingEditor = true;
|
||||
|
||||
@ -115,8 +115,8 @@ MovingPixelsState::~MovingPixelsState()
|
||||
m_pixelsMovement.reset(NULL);
|
||||
|
||||
removeAsEditorObserver();
|
||||
m_editor->getManager()->removeMessageFilter(kKeyDownMessage, m_editor);
|
||||
m_editor->getManager()->removeMessageFilter(kKeyUpMessage, m_editor);
|
||||
m_editor->manager()->removeMessageFilter(kKeyDownMessage, m_editor);
|
||||
m_editor->manager()->removeMessageFilter(kKeyUpMessage, m_editor);
|
||||
|
||||
m_editor->document()->generateMaskBoundaries();
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ void PixelsMovement::flipImage(doc::algorithm::FlipType flipType)
|
||||
// Flip the mask.
|
||||
doc::algorithm::flip_image(
|
||||
m_initialMask->bitmap(),
|
||||
gfx::Rect(gfx::Point(0, 0), m_initialMask->bounds().getSize()),
|
||||
gfx::Rect(gfx::Point(0, 0), m_initialMask->bounds().size()),
|
||||
flipType);
|
||||
|
||||
{
|
||||
@ -465,7 +465,7 @@ void PixelsMovement::getDraggedImageCopy(base::UniquePtr<Image>& outputImage,
|
||||
gfx::Rect bounds = m_currentData.transformedBounds();
|
||||
base::UniquePtr<Image> image(Image::create(m_sprite->pixelFormat(), bounds.w, bounds.h));
|
||||
|
||||
drawImage(image, bounds.getOrigin(), false);
|
||||
drawImage(image, bounds.origin(), false);
|
||||
|
||||
// Draw mask without shrinking it, so the mask size is equal to the
|
||||
// "image" render.
|
||||
@ -544,7 +544,7 @@ void PixelsMovement::dropImageTemporarily()
|
||||
|
||||
// Get the a factor for the X/Y position of the initial pivot
|
||||
// position inside the initial non-rotated bounds.
|
||||
gfx::PointT<double> pivotPosFactor(m_initialData.pivot() - m_initialData.bounds().getOrigin());
|
||||
gfx::PointT<double> pivotPosFactor(m_initialData.pivot() - m_initialData.bounds().origin());
|
||||
pivotPosFactor.x /= m_initialData.bounds().w;
|
||||
pivotPosFactor.y /= m_initialData.bounds().h;
|
||||
|
||||
@ -622,7 +622,7 @@ gfx::Rect PixelsMovement::getImageBounds()
|
||||
|
||||
gfx::Size PixelsMovement::getInitialImageSize() const
|
||||
{
|
||||
return m_initialData.bounds().getSize();
|
||||
return m_initialData.bounds().size();
|
||||
}
|
||||
|
||||
void PixelsMovement::setMaskColor(bool opaque, color_t mask_color)
|
||||
@ -651,7 +651,7 @@ void PixelsMovement::redrawExtraImage()
|
||||
|
||||
// Draw the transformed pixels in the extra-cel which is the chunk
|
||||
// of pixels that the user is moving.
|
||||
drawImage(m_extraCel->image(), bounds.getOrigin(), true);
|
||||
drawImage(m_extraCel->image(), bounds.origin(), true);
|
||||
}
|
||||
|
||||
void PixelsMovement::redrawCurrentMask()
|
||||
@ -707,7 +707,7 @@ void PixelsMovement::drawMask(doc::Mask* mask, bool shrink)
|
||||
drawParallelogram(mask->bitmap(),
|
||||
m_initialMask->bitmap(),
|
||||
nullptr,
|
||||
corners, bounds.getOrigin());
|
||||
corners, bounds.origin());
|
||||
if (shrink)
|
||||
mask->unfreeze();
|
||||
}
|
||||
@ -723,7 +723,7 @@ void PixelsMovement::drawParallelogram(
|
||||
// fast rotation algorithm, as it's pixel-perfect match with the
|
||||
// original selection when just a translation is applied.
|
||||
if (m_currentData.angle() == 0.0 &&
|
||||
m_currentData.bounds().getSize() == src->size()) {
|
||||
m_currentData.bounds().size() == src->size()) {
|
||||
rotAlgo = tools::RotationAlgorithm::FAST;
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ void PlayState::onBeforeCommandExecution(CommandExecutionEvent& ev)
|
||||
// This check just in case we stay connected to context signals when
|
||||
// the editor is already deleted.
|
||||
ASSERT(m_editor);
|
||||
ASSERT(m_editor->getManager() == ui::Manager::getDefault());
|
||||
ASSERT(m_editor->manager() == ui::Manager::getDefault());
|
||||
|
||||
// If the command is for other editor, we don't stop the animation.
|
||||
if (!m_editor->isActive())
|
||||
|
@ -50,7 +50,7 @@ bool ScrollingState::onMouseUp(Editor* editor, MouseMessage* msg)
|
||||
bool ScrollingState::onMouseMove(Editor* editor, MouseMessage* msg)
|
||||
{
|
||||
View* view = View::getView(editor);
|
||||
gfx::Point scroll = view->getViewScroll();
|
||||
gfx::Point scroll = view->viewScroll();
|
||||
gfx::Point newPos = msg->position();
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -266,7 +266,7 @@ void SelectBoxState::postRenderDecorator(EditorPostRender* render)
|
||||
Editor* editor = render->getEditor();
|
||||
render::Zoom zoom = editor->zoom();
|
||||
gfx::Rect sp = editor->sprite()->bounds();
|
||||
gfx::Rect vp = View::getView(editor)->getViewportBounds();
|
||||
gfx::Rect vp = View::getView(editor)->viewportBounds();
|
||||
vp.w += zoom.apply(1);
|
||||
vp.h += zoom.apply(1);
|
||||
vp = editor->screenToEditor(vp);
|
||||
|
@ -664,7 +664,7 @@ void StandbyState::Decorator::postRenderDecorator(EditorPostRender* render)
|
||||
gfx::Rect box1, box2;
|
||||
if (StandbyState::Decorator::getSymmetryHandles(editor, box1, box2)) {
|
||||
skin::SkinTheme* theme = static_cast<skin::SkinTheme*>(CurrentTheme::get());
|
||||
she::Surface* part = theme->parts.transformationHandle()->getBitmap(0);
|
||||
she::Surface* part = theme->parts.transformationHandle()->bitmap(0);
|
||||
ScreenGraphics g;
|
||||
g.drawRgbaSurface(part, box1.x, box1.y);
|
||||
g.drawRgbaSurface(part, box2.x, box2.y);
|
||||
@ -685,7 +685,7 @@ bool StandbyState::Decorator::getSymmetryHandles(Editor* editor, gfx::Rect& box1
|
||||
symmetry.yAxis());
|
||||
gfx::Rect spriteBounds = editor->sprite()->bounds();
|
||||
skin::SkinTheme* theme = static_cast<skin::SkinTheme*>(CurrentTheme::get());
|
||||
she::Surface* part = theme->parts.transformationHandle()->getBitmap(0);
|
||||
she::Surface* part = theme->parts.transformationHandle()->bitmap(0);
|
||||
gfx::Point pt1, pt2;
|
||||
if (horz) {
|
||||
pt1 = gfx::Point(spriteBounds.x+pos, spriteBounds.y);
|
||||
|
@ -134,14 +134,14 @@ bool StateWithWheelBehavior::onMouseWheel(Editor* editor, MouseMessage* msg)
|
||||
case WHEEL_HSCROLL:
|
||||
case WHEEL_VSCROLL: {
|
||||
View* view = View::getView(editor);
|
||||
gfx::Point scroll = view->getViewScroll();
|
||||
gfx::Point scroll = view->viewScroll();
|
||||
gfx::Point delta(0, 0);
|
||||
|
||||
if (msg->preciseWheel()) {
|
||||
delta = msg->wheelDelta();
|
||||
}
|
||||
else {
|
||||
gfx::Rect vp = view->getViewportBounds();
|
||||
gfx::Rect vp = view->viewportBounds();
|
||||
|
||||
if (wheelAction == WHEEL_HSCROLL) {
|
||||
delta.x = dz * vp.w;
|
||||
|
@ -55,7 +55,7 @@ static struct HandlesInfo {
|
||||
HandleType TransformHandles::getHandleAtPoint(Editor* editor, const gfx::Point& pt, const gfx::Transformation& transform)
|
||||
{
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(CurrentTheme::get());
|
||||
she::Surface* gfx = theme->parts.transformationHandle()->getBitmap(0);
|
||||
she::Surface* gfx = theme->parts.transformationHandle()->bitmap(0);
|
||||
fixmath::fixed angle = fixmath::ftofix(128.0 * transform.angle() / PI);
|
||||
|
||||
gfx::Transformation::Corners corners;
|
||||
@ -105,8 +105,8 @@ void TransformHandles::drawHandles(Editor* editor, const gfx::Transformation& tr
|
||||
// -----------------------------------------------
|
||||
{
|
||||
gfx::Point
|
||||
a(transform.bounds().getOrigin()),
|
||||
b(transform.bounds().getPoint2());
|
||||
a(transform.bounds().origin()),
|
||||
b(transform.bounds().point2());
|
||||
a = editor->editorToScreen(a);
|
||||
b = editor->editorToScreen(b);
|
||||
g.drawRect(gfx::rgba(255, 0, 0), gfx::Rect(a, b));
|
||||
@ -130,7 +130,7 @@ void TransformHandles::drawHandles(Editor* editor, const gfx::Transformation& tr
|
||||
if (visiblePivot(angle)) {
|
||||
gfx::Rect pivotBounds = getPivotHandleBounds(editor, transform, corners);
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(CurrentTheme::get());
|
||||
she::Surface* part = theme->parts.pivotHandle()->getBitmap(0);
|
||||
she::Surface* part = theme->parts.pivotHandle()->bitmap(0);
|
||||
|
||||
g.drawRgbaSurface(part, pivotBounds.x, pivotBounds.y);
|
||||
}
|
||||
@ -151,7 +151,7 @@ void TransformHandles::invalidateHandles(Editor* editor, const gfx::Transformati
|
||||
|
||||
// Invalidate each corner handle.
|
||||
for (size_t c=0; c<HANDLES; ++c) {
|
||||
she::Surface* part = theme->parts.transformationHandle()->getBitmap(0);
|
||||
she::Surface* part = theme->parts.transformationHandle()->bitmap(0);
|
||||
int u = (screenPoints[handles_info[c].i1].x+screenPoints[handles_info[c].i2].x)/2;
|
||||
int v = (screenPoints[handles_info[c].i1].y+screenPoints[handles_info[c].i2].y)/2;
|
||||
|
||||
@ -163,7 +163,7 @@ void TransformHandles::invalidateHandles(Editor* editor, const gfx::Transformati
|
||||
// Invalidate area where the pivot is.
|
||||
if (visiblePivot(angle)) {
|
||||
gfx::Rect pivotBounds = getPivotHandleBounds(editor, transform, corners);
|
||||
she::Surface* part = theme->parts.pivotHandle()->getBitmap(0);
|
||||
she::Surface* part = theme->parts.pivotHandle()->bitmap(0);
|
||||
|
||||
editor->invalidateRect(
|
||||
gfx::Rect(pivotBounds.x, pivotBounds.y,
|
||||
@ -176,7 +176,7 @@ gfx::Rect TransformHandles::getPivotHandleBounds(Editor* editor,
|
||||
const gfx::Transformation::Corners& corners)
|
||||
{
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(CurrentTheme::get());
|
||||
gfx::Size partSize = theme->parts.pivotHandle()->getSize();
|
||||
gfx::Size partSize = theme->parts.pivotHandle()->size();
|
||||
gfx::Point screenPivotPos = editor->editorToScreen(transform.pivot());
|
||||
|
||||
screenPivotPos.x += editor->zoom().apply(1) / 2;
|
||||
@ -200,7 +200,7 @@ bool TransformHandles::inHandle(const gfx::Point& pt, int x, int y, int gfx_w, i
|
||||
void TransformHandles::drawHandle(Graphics* g, int x, int y, fixmath::fixed angle)
|
||||
{
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(CurrentTheme::get());
|
||||
she::Surface* part = theme->parts.transformationHandle()->getBitmap(0);
|
||||
she::Surface* part = theme->parts.transformationHandle()->bitmap(0);
|
||||
|
||||
adjustHandle(x, y, part->width(), part->height(), angle);
|
||||
|
||||
|
@ -70,7 +70,7 @@ bool ZoomingState::onMouseUp(Editor* editor, MouseMessage* msg)
|
||||
bool ZoomingState::onMouseMove(Editor* editor, MouseMessage* msg)
|
||||
{
|
||||
gfx::Point pt = (msg->position() - m_startPos);
|
||||
int threshold = 8 * guiscale() * editor->getManager()->getDisplay()->scale();
|
||||
int threshold = 8 * guiscale() * editor->manager()->getDisplay()->scale();
|
||||
|
||||
if (m_moved || std::sqrt(pt.x*pt.x + pt.y*pt.y) > threshold) {
|
||||
m_moved = true;
|
||||
|
@ -99,7 +99,7 @@ void FileList::setCurrentFolder(IFileItem* folder)
|
||||
void FileList::goUp()
|
||||
{
|
||||
IFileItem* folder = m_currentFolder;
|
||||
IFileItem* parent = folder->getParent();
|
||||
IFileItem* parent = folder->parent();
|
||||
if (parent) {
|
||||
setCurrentFolder(parent);
|
||||
m_selected = folder;
|
||||
@ -119,8 +119,8 @@ bool FileList::onProcessMessage(Message* msg)
|
||||
case kMouseMoveMessage:
|
||||
if (hasCapture()) {
|
||||
MouseMessage* mouseMsg = static_cast<MouseMessage*>(msg);
|
||||
int th = getTextHeight();
|
||||
int y = getBounds().y;
|
||||
int th = textHeight();
|
||||
int y = bounds().y;
|
||||
IFileItem* old_selected = m_selected;
|
||||
m_selected = NULL;
|
||||
|
||||
@ -196,19 +196,19 @@ bool FileList::onProcessMessage(Message* msg)
|
||||
case kKeyPageUp:
|
||||
case kKeyPageDown: {
|
||||
int sgn = (scancode == kKeyPageUp) ? -1: 1;
|
||||
gfx::Rect vp = view->getViewportBounds();
|
||||
gfx::Rect vp = view->viewportBounds();
|
||||
if (select < 0)
|
||||
select = 0;
|
||||
select += sgn * vp.h / (getTextHeight()+4*guiscale());
|
||||
select += sgn * vp.h / (textHeight()+4*guiscale());
|
||||
break;
|
||||
}
|
||||
|
||||
case kKeyLeft:
|
||||
case kKeyRight:
|
||||
if (select >= 0) {
|
||||
gfx::Rect vp = view->getViewportBounds();
|
||||
gfx::Rect vp = view->viewportBounds();
|
||||
int sgn = (scancode == kKeyLeft) ? -1: 1;
|
||||
gfx::Point scroll = view->getViewScroll();
|
||||
gfx::Point scroll = view->viewScroll();
|
||||
scroll.x += vp.w/2*sgn;
|
||||
view->setViewScroll(scroll);
|
||||
}
|
||||
@ -255,7 +255,7 @@ bool FileList::onProcessMessage(Message* msg)
|
||||
|
||||
for (i=MAX(select, 0); i<bottom; ++i, ++link) {
|
||||
IFileItem* fi = *link;
|
||||
if (base::utf8_icmp(fi->getDisplayName(), m_isearch, chrs) == 0) {
|
||||
if (base::utf8_icmp(fi->displayName(), m_isearch, chrs) == 0) {
|
||||
select = i;
|
||||
break;
|
||||
}
|
||||
@ -277,8 +277,8 @@ bool FileList::onProcessMessage(Message* msg)
|
||||
case kMouseWheelMessage: {
|
||||
View* view = View::getView(this);
|
||||
if (view) {
|
||||
gfx::Point scroll = view->getViewScroll();
|
||||
scroll += static_cast<MouseMessage*>(msg)->wheelDelta() * 3*(getTextHeight()+4*guiscale());
|
||||
gfx::Point scroll = view->viewScroll();
|
||||
scroll += static_cast<MouseMessage*>(msg)->wheelDelta() * 3*(textHeight()+4*guiscale());
|
||||
view->setViewScroll(scroll);
|
||||
}
|
||||
break;
|
||||
@ -304,11 +304,11 @@ bool FileList::onProcessMessage(Message* msg)
|
||||
|
||||
void FileList::onPaint(ui::PaintEvent& ev)
|
||||
{
|
||||
Graphics* g = ev.getGraphics();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
Graphics* g = ev.graphics();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
View* view = View::getView(this);
|
||||
gfx::Rect vp = view->getViewportBounds();
|
||||
gfx::Rect bounds = getClientBounds();
|
||||
gfx::Rect vp = view->viewportBounds();
|
||||
gfx::Rect bounds = clientBounds();
|
||||
int x, y = bounds.y;
|
||||
int evenRow = 0;
|
||||
gfx::Color bgcolor;
|
||||
@ -345,7 +345,7 @@ void FileList::onPaint(ui::PaintEvent& ev)
|
||||
g->fillRect(bgcolor, gfx::Rect(bounds.x, y, bounds.w, itemSize.h));
|
||||
|
||||
if (fi->isFolder()) {
|
||||
int icon_w = getFont()->textLength("[+]");
|
||||
int icon_w = font()->textLength("[+]");
|
||||
|
||||
g->drawUIString("[+]", fgcolor, bgcolor, gfx::Point(x, y+2*guiscale()));
|
||||
x += icon_w+2*guiscale();
|
||||
@ -353,7 +353,7 @@ void FileList::onPaint(ui::PaintEvent& ev)
|
||||
|
||||
// item name
|
||||
g->drawString(
|
||||
fi->getDisplayName().c_str(),
|
||||
fi->displayName().c_str(),
|
||||
fgcolor, bgcolor, gfx::Point(x, y+2*guiscale()));
|
||||
|
||||
// draw progress bars
|
||||
@ -386,10 +386,10 @@ void FileList::onPaint(ui::PaintEvent& ev)
|
||||
// Draw the thumbnail
|
||||
if (thumbnail) {
|
||||
x = vp.x+vp.w - 2*guiscale() - thumbnail->width();
|
||||
y = thumbnail_y - thumbnail->height()/2 + getBounds().y;
|
||||
y = thumbnail_y - thumbnail->height()/2 + this->bounds().y;
|
||||
y = MID(vp.y+2*guiscale(), y, vp.y+vp.h-3*guiscale()-thumbnail->height());
|
||||
x -= getBounds().x;
|
||||
y -= getBounds().y;
|
||||
x -= this->bounds().x;
|
||||
y -= this->bounds().y;
|
||||
|
||||
g->blit(thumbnail, 0, 0, x, y, thumbnail->width(), thumbnail->height());
|
||||
g->drawRect(gfx::rgba(0, 0, 0),
|
||||
@ -454,20 +454,20 @@ gfx::Size FileList::getFileItemSize(IFileItem* fi) const
|
||||
int len = 0;
|
||||
|
||||
if (fi->isFolder())
|
||||
len += getFont()->textLength("[+]") + 2*guiscale();
|
||||
len += font()->textLength("[+]") + 2*guiscale();
|
||||
|
||||
len += getFont()->textLength(fi->getDisplayName().c_str());
|
||||
len += font()->textLength(fi->displayName().c_str());
|
||||
|
||||
return gfx::Size(len+4*guiscale(), getTextHeight()+4*guiscale());
|
||||
return gfx::Size(len+4*guiscale(), textHeight()+4*guiscale());
|
||||
}
|
||||
|
||||
void FileList::makeSelectedFileitemVisible()
|
||||
{
|
||||
View* view = View::getView(this);
|
||||
gfx::Rect vp = view->getViewportBounds();
|
||||
gfx::Point scroll = view->getViewScroll();
|
||||
int th = getTextHeight();
|
||||
int y = getBounds().y;
|
||||
gfx::Rect vp = view->viewportBounds();
|
||||
gfx::Point scroll = view->viewScroll();
|
||||
int th = textHeight();
|
||||
int y = bounds().y;
|
||||
|
||||
// rows
|
||||
for (FileItemList::iterator
|
||||
@ -478,9 +478,9 @@ void FileList::makeSelectedFileitemVisible()
|
||||
|
||||
if (fi == m_selected) {
|
||||
if (y < vp.y)
|
||||
scroll.y = y - getBounds().y;
|
||||
scroll.y = y - bounds().y;
|
||||
else if (y > vp.y + vp.h - (th+4*guiscale()))
|
||||
scroll.y = y - getBounds().y - vp.h + (th+4*guiscale());
|
||||
scroll.y = y - bounds().y - vp.h + (th+4*guiscale());
|
||||
|
||||
view->setViewScroll(scroll);
|
||||
break;
|
||||
@ -493,7 +493,7 @@ void FileList::makeSelectedFileitemVisible()
|
||||
void FileList::regenerateList()
|
||||
{
|
||||
// get the children of the current folder
|
||||
m_list = m_currentFolder->getChildren();
|
||||
m_list = m_currentFolder->children();
|
||||
|
||||
// filter the list by the available extensions
|
||||
if (!m_exts.empty()) {
|
||||
|
@ -112,14 +112,14 @@ protected:
|
||||
removeAllItems();
|
||||
|
||||
// String to be autocompleted
|
||||
std::string left_part = getEntryWidget()->getText();
|
||||
std::string left_part = getEntryWidget()->text();
|
||||
closeListBox();
|
||||
|
||||
if (left_part.empty())
|
||||
return;
|
||||
|
||||
for (const IFileItem* child : m_fileList->getFileList()) {
|
||||
std::string child_name = child->getDisplayName();
|
||||
std::string child_name = child->displayName();
|
||||
std::string::const_iterator it1, it2;
|
||||
|
||||
for (it1 = child_name.begin(), it2 = left_part.begin();
|
||||
@ -185,10 +185,10 @@ protected:
|
||||
bool onProcessMessage(ui::Message* msg) override {
|
||||
switch (msg->type()) {
|
||||
case kOpenMessage:
|
||||
getManager()->addMessageFilter(kKeyDownMessage, this);
|
||||
manager()->addMessageFilter(kKeyDownMessage, this);
|
||||
break;
|
||||
case kCloseMessage:
|
||||
getManager()->removeMessageFilter(kKeyDownMessage, this);
|
||||
manager()->removeMessageFilter(kKeyDownMessage, this);
|
||||
break;
|
||||
case kKeyDownMessage: {
|
||||
KeyMessage* keyMsg = static_cast<KeyMessage*>(msg);
|
||||
@ -457,7 +457,7 @@ again:
|
||||
|
||||
// up a level?
|
||||
if (fn == "..") {
|
||||
enter_folder = folder->getParent();
|
||||
enter_folder = folder->parent();
|
||||
if (!enter_folder)
|
||||
enter_folder = folder;
|
||||
}
|
||||
@ -476,14 +476,14 @@ again:
|
||||
#endif
|
||||
|
||||
for (IFileItem* child : children) {
|
||||
std::string child_name = child->getDisplayName();
|
||||
std::string child_name = child->displayName();
|
||||
|
||||
#ifdef _WIN32
|
||||
child_name = base::string_to_lower(child_name);
|
||||
#endif
|
||||
if (child_name == fn2) {
|
||||
enter_folder = child;
|
||||
buf = enter_folder->getFileName();
|
||||
buf = enter_folder->fileName();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -493,7 +493,7 @@ again:
|
||||
if (base::is_path_separator(*fn.begin())) { // absolute path (UNIX style)
|
||||
#ifdef _WIN32
|
||||
// get the drive of the current folder
|
||||
std::string drive = folder->getFileName();
|
||||
std::string drive = folder->fileName();
|
||||
if (drive.size() >= 2 && drive[1] == ':') {
|
||||
buf += drive[0];
|
||||
buf += ':';
|
||||
@ -517,7 +517,7 @@ again:
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
buf = folder->getFileName();
|
||||
buf = folder->fileName();
|
||||
buf = base::join_path(buf, fn);
|
||||
}
|
||||
buf = base::fix_path_separators(buf);
|
||||
@ -577,7 +577,7 @@ again:
|
||||
result = buf;
|
||||
|
||||
// save the path in the configuration file
|
||||
std::string lastpath = folder->getKeyName();
|
||||
std::string lastpath = folder->keyName();
|
||||
set_config_string("FileSelect", "CurrentDirectory",
|
||||
lastpath.c_str());
|
||||
|
||||
@ -600,7 +600,7 @@ void FileSelector::updateLocation()
|
||||
|
||||
while (fileItem != NULL) {
|
||||
locations.push_front(fileItem);
|
||||
fileItem = fileItem->getParent();
|
||||
fileItem = fileItem->parent();
|
||||
}
|
||||
|
||||
// Clear all the items from the combo-box
|
||||
@ -618,7 +618,7 @@ void FileSelector::updateLocation()
|
||||
buf += " ";
|
||||
|
||||
// Location name
|
||||
buf += fileItem->getDisplayName();
|
||||
buf += fileItem->displayName();
|
||||
|
||||
// Add the new location to the combo-box
|
||||
location()->addItem(new CustomFileNameItem(buf.c_str(), fileItem));
|
||||
@ -643,7 +643,7 @@ void FileSelector::updateLocation()
|
||||
// Select the location
|
||||
{
|
||||
location()->setSelectedItemIndex(selected_index);
|
||||
location()->getEntryWidget()->setText(currentFolder->getDisplayName().c_str());
|
||||
location()->getEntryWidget()->setText(currentFolder->displayName().c_str());
|
||||
location()->getEntryWidget()->deselectText();
|
||||
}
|
||||
}
|
||||
@ -735,17 +735,16 @@ void FileSelector::onNewFolder()
|
||||
if (window.getKiller() == window.ok()) {
|
||||
IFileItem* currentFolder = m_fileList->getCurrentFolder();
|
||||
if (currentFolder) {
|
||||
std::string dirname = window.name()->getText();
|
||||
std::string dirname = window.name()->text();
|
||||
|
||||
// Create the new directory
|
||||
try {
|
||||
currentFolder->createDirectory(dirname);
|
||||
|
||||
// Enter in the new folder
|
||||
for (FileItemList::const_iterator it=currentFolder->getChildren().begin(),
|
||||
end=currentFolder->getChildren().end(); it != end; ++it) {
|
||||
if ((*it)->getDisplayName() == dirname) {
|
||||
m_fileList->setCurrentFolder(*it);
|
||||
for (auto child : currentFolder->children()) {
|
||||
if (child->displayName() == dirname) {
|
||||
m_fileList->setCurrentFolder(child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -771,7 +770,7 @@ void FileSelector::onLocationCloseListBox()
|
||||
dynamic_cast<CustomFolderNameItem*>(location()->getSelectedItem());
|
||||
|
||||
if (comboFolderItem != NULL) {
|
||||
std::string path = comboFolderItem->getText();
|
||||
std::string path = comboFolderItem->text();
|
||||
fileItem = FileSystemModule::instance()->getFileItemFromPath(path);
|
||||
}
|
||||
}
|
||||
@ -781,7 +780,7 @@ void FileSelector::onLocationCloseListBox()
|
||||
|
||||
// Refocus the 'fileview' (the focus in that widget is more
|
||||
// useful for the user)
|
||||
getManager()->setFocus(m_fileList);
|
||||
manager()->setFocus(m_fileList);
|
||||
}
|
||||
}
|
||||
|
||||
@ -816,7 +815,7 @@ void FileSelector::onFileListFileSelected()
|
||||
IFileItem* fileitem = m_fileList->getSelectedFileItem();
|
||||
|
||||
if (!fileitem->isFolder()) {
|
||||
std::string filename = base::get_file_name(fileitem->getFileName());
|
||||
std::string filename = base::get_file_name(fileitem->fileName());
|
||||
|
||||
m_fileName->setValue(filename.c_str());
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ private:
|
||||
ListItem::onPaint(ev);
|
||||
|
||||
if (m_image) {
|
||||
Graphics* g = ev.getGraphics();
|
||||
Graphics* g = ev.graphics();
|
||||
she::Surface* sur = she::instance()->createRgbaSurface(m_image->width(),
|
||||
m_image->height());
|
||||
|
||||
@ -74,7 +74,7 @@ private:
|
||||
m_image.get(), nullptr, sur,
|
||||
0, 0, 0, 0, m_image->width(), m_image->height());
|
||||
|
||||
g->drawRgbaSurface(sur, getTextWidth()+4, 0);
|
||||
g->drawRgbaSurface(sur, textWidth()+4, 0);
|
||||
sur->dispose();
|
||||
}
|
||||
}
|
||||
@ -93,7 +93,7 @@ private:
|
||||
if (m_image)
|
||||
return;
|
||||
|
||||
ListBox* listbox = static_cast<ListBox*>(getParent());
|
||||
ListBox* listbox = static_cast<ListBox*>(parent());
|
||||
if (!listbox)
|
||||
return;
|
||||
|
||||
|
@ -45,7 +45,7 @@ bool FrameTagWindow::show()
|
||||
|
||||
std::string FrameTagWindow::nameValue()
|
||||
{
|
||||
return name()->getText();
|
||||
return name()->text();
|
||||
}
|
||||
|
||||
void FrameTagWindow::rangeValue(doc::frame_t& from, doc::frame_t& to)
|
||||
@ -53,8 +53,8 @@ void FrameTagWindow::rangeValue(doc::frame_t& from, doc::frame_t& to)
|
||||
doc::frame_t first = 0;
|
||||
doc::frame_t last = m_sprite->lastFrame();
|
||||
|
||||
from = this->from()->getTextInt()-1;
|
||||
to = this->to()->getTextInt()-1;
|
||||
from = this->from()->textInt()-1;
|
||||
to = this->to()->textInt()-1;
|
||||
from = MID(first, from, last);
|
||||
to = MID(from, to, last);
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ void HexColorEntry::setColor(const app::Color& color)
|
||||
|
||||
void HexColorEntry::onEntryChange()
|
||||
{
|
||||
std::string text = m_entry.getText();
|
||||
std::string text = m_entry.text();
|
||||
int r, g, b;
|
||||
|
||||
// Remove non hex digits
|
||||
|
@ -44,7 +44,7 @@ HomeView::HomeView()
|
||||
, m_dataRecovery(nullptr)
|
||||
, m_dataRecoveryView(nullptr)
|
||||
{
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
setBgColor(theme->colors.workspace());
|
||||
setChildSpacing(8 * guiscale());
|
||||
|
||||
@ -64,7 +64,7 @@ HomeView::~HomeView()
|
||||
{
|
||||
#ifdef ENABLE_DATA_RECOVERY
|
||||
if (m_dataRecoveryView) {
|
||||
if (m_dataRecoveryView->getParent())
|
||||
if (m_dataRecoveryView->parent())
|
||||
App::instance()->getMainWindow()->getWorkspace()->removeView(m_dataRecoveryView);
|
||||
delete m_dataRecoveryView;
|
||||
}
|
||||
@ -122,9 +122,9 @@ void HomeView::onOpenFile()
|
||||
|
||||
void HomeView::onResize(ui::ResizeEvent& ev)
|
||||
{
|
||||
headerPlaceholder()->setVisible(ev.getBounds().h > 200*ui::guiscale());
|
||||
foldersPlaceholder()->setVisible(ev.getBounds().h > 150*ui::guiscale());
|
||||
newsPlaceholder()->setVisible(ev.getBounds().w > 200*ui::guiscale());
|
||||
headerPlaceholder()->setVisible(ev.bounds().h > 200*ui::guiscale());
|
||||
foldersPlaceholder()->setVisible(ev.bounds().h > 150*ui::guiscale());
|
||||
newsPlaceholder()->setVisible(ev.bounds().w > 200*ui::guiscale());
|
||||
|
||||
ui::VBox::onResize(ev);
|
||||
}
|
||||
@ -149,7 +149,7 @@ void HomeView::onUpToDate()
|
||||
|
||||
void HomeView::onNewUpdate(const std::string& url, const std::string& version)
|
||||
{
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
|
||||
checkUpdate()->setText("New " PACKAGE " v" + version + " available!");
|
||||
checkUpdate()->setUrl(url);
|
||||
@ -184,7 +184,7 @@ void HomeView::onRecoverSprites()
|
||||
});
|
||||
}
|
||||
|
||||
if (!m_dataRecoveryView->getParent())
|
||||
if (!m_dataRecoveryView->parent())
|
||||
App::instance()->getMainWindow()->getWorkspace()->addView(m_dataRecoveryView);
|
||||
|
||||
App::instance()->getMainWindow()->getTabsBar()->selectTab(m_dataRecoveryView);
|
||||
|
@ -40,7 +40,7 @@ void IconButton::onSizeHint(SizeHintEvent& ev)
|
||||
void IconButton::onPaint(PaintEvent& ev)
|
||||
{
|
||||
SkinTheme* theme = SkinTheme::instance();
|
||||
Graphics* g = ev.getGraphics();
|
||||
Graphics* g = ev.graphics();
|
||||
gfx::Color fg, bg;
|
||||
|
||||
if (isSelected()) {
|
||||
@ -53,12 +53,12 @@ void IconButton::onPaint(PaintEvent& ev)
|
||||
}
|
||||
else {
|
||||
fg = theme->colors.menuitemNormalText();
|
||||
bg = getBgColor();
|
||||
bg = bgColor();
|
||||
}
|
||||
|
||||
g->fillRect(bg, g->getClipBounds());
|
||||
|
||||
gfx::Rect bounds = getClientBounds();
|
||||
gfx::Rect bounds = clientBounds();
|
||||
g->drawColoredRgbaSurface(
|
||||
m_icon, fg,
|
||||
bounds.x+bounds.w/2-m_icon->width()/2,
|
||||
|
@ -56,7 +56,7 @@ MainWindow::MainWindow()
|
||||
m_notifications = new Notifications();
|
||||
m_contextBar = new ContextBar();
|
||||
m_statusBar = new StatusBar();
|
||||
m_colorBar = new ColorBar(colorBarPlaceholder()->getAlign());
|
||||
m_colorBar = new ColorBar(colorBarPlaceholder()->align());
|
||||
m_toolBar = new ToolBar();
|
||||
m_tabsBar = new WorkspaceTabs(this);
|
||||
m_workspace = new Workspace();
|
||||
@ -105,12 +105,12 @@ MainWindow::MainWindow()
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
if (m_devConsoleView) {
|
||||
if (m_devConsoleView->getParent())
|
||||
if (m_devConsoleView->parent())
|
||||
m_workspace->removeView(m_devConsoleView);
|
||||
delete m_devConsoleView;
|
||||
}
|
||||
if (m_homeView) {
|
||||
if (m_homeView->getParent())
|
||||
if (m_homeView->parent())
|
||||
m_workspace->removeView(m_homeView);
|
||||
delete m_homeView;
|
||||
}
|
||||
@ -158,12 +158,12 @@ void MainWindow::showNotification(INotificationDelegate* del)
|
||||
{
|
||||
m_notifications->addLink(del);
|
||||
m_notifications->setVisible(true);
|
||||
m_notifications->getParent()->layout();
|
||||
m_notifications->parent()->layout();
|
||||
}
|
||||
|
||||
void MainWindow::showHomeOnOpen()
|
||||
{
|
||||
if (!getHomeView()->getParent()) {
|
||||
if (!getHomeView()->parent()) {
|
||||
TabView* selectedTab = m_tabsBar->getSelectedTab();
|
||||
|
||||
// Show "Home" tab in the first position, and select it only if
|
||||
@ -178,7 +178,7 @@ void MainWindow::showHomeOnOpen()
|
||||
|
||||
void MainWindow::showHome()
|
||||
{
|
||||
if (!getHomeView()->getParent()) {
|
||||
if (!getHomeView()->parent()) {
|
||||
m_workspace->addView(m_homeView, 0);
|
||||
}
|
||||
m_tabsBar->selectTab(m_homeView);
|
||||
@ -194,7 +194,7 @@ void MainWindow::showDevConsole()
|
||||
if (!m_devConsoleView)
|
||||
m_devConsoleView = new DevConsoleView;
|
||||
|
||||
if (!m_devConsoleView->getParent()) {
|
||||
if (!m_devConsoleView->parent()) {
|
||||
m_workspace->addView(m_devConsoleView);
|
||||
m_tabsBar->selectTab(m_devConsoleView);
|
||||
}
|
||||
|
@ -127,17 +127,17 @@ public:
|
||||
|
||||
protected:
|
||||
void onSizeHint(SizeHintEvent& ev) override {
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
Style* style = theme->styles.newsItem();
|
||||
Style* styleDetail = theme->styles.newsItemDetail();
|
||||
Style::State state;
|
||||
gfx::Size sz1 = style->sizeHint(getText().c_str(), state);
|
||||
gfx::Size sz1 = style->sizeHint(text().c_str(), state);
|
||||
gfx::Size sz2, sz2fourlines;
|
||||
|
||||
if (!m_desc.empty()) {
|
||||
View* view = View::getView(getParent());
|
||||
View* view = View::getView(parent());
|
||||
sz2 = styleDetail->sizeHint(m_desc.c_str(), state,
|
||||
(view ? view->getViewportBounds().w: 0));
|
||||
(view ? view->viewportBounds().w: 0));
|
||||
sz2fourlines = styleDetail->sizeHint("\n\n\n", state);
|
||||
}
|
||||
|
||||
@ -145,24 +145,24 @@ protected:
|
||||
}
|
||||
|
||||
void onPaint(PaintEvent& ev) override {
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
Graphics* g = ev.getGraphics();
|
||||
gfx::Rect bounds = getClientBounds();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
Graphics* g = ev.graphics();
|
||||
gfx::Rect bounds = clientBounds();
|
||||
Style* style = theme->styles.newsItem();
|
||||
Style* styleDetail = theme->styles.newsItemDetail();
|
||||
|
||||
Style::State state;
|
||||
if (hasMouse() && !getManager()->getCapture()) state += Style::hover();
|
||||
if (hasMouse() && !manager()->getCapture()) state += Style::hover();
|
||||
if (isSelected()) state += Style::active();
|
||||
if (getParent()->hasCapture()) state += Style::clicked();
|
||||
if (parent()->hasCapture()) state += Style::clicked();
|
||||
|
||||
gfx::Size textSize = style->sizeHint(getText().c_str(), state);
|
||||
gfx::Size textSize = style->sizeHint(text().c_str(), state);
|
||||
gfx::Rect textBounds(bounds.x, bounds.y, bounds.w, textSize.h);
|
||||
gfx::Rect detailsBounds(
|
||||
bounds.x, bounds.y+textSize.h,
|
||||
bounds.w, bounds.h-textSize.h);
|
||||
|
||||
style->paint(g, textBounds, getText().c_str(), state);
|
||||
style->paint(g, textBounds, text().c_str(), state);
|
||||
styleDetail->paint(g, detailsBounds, m_desc.c_str(), state);
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ public:
|
||||
|
||||
protected:
|
||||
void onClick() override {
|
||||
static_cast<NewsListBox*>(getParent())->reload();
|
||||
static_cast<NewsListBox*>(parent())->reload();
|
||||
}
|
||||
};
|
||||
|
||||
@ -208,8 +208,8 @@ void NewsListBox::reload()
|
||||
if (m_loader || m_timer.isRunning())
|
||||
return;
|
||||
|
||||
while (getLastChild())
|
||||
removeChild(getLastChild());
|
||||
while (lastChild())
|
||||
removeChild(lastChild());
|
||||
|
||||
View* view = View::getView(this);
|
||||
if (view)
|
||||
|
@ -60,13 +60,13 @@ void Notifications::onSizeHint(SizeHintEvent& ev)
|
||||
|
||||
void Notifications::onPaint(PaintEvent& ev)
|
||||
{
|
||||
Graphics* g = ev.getGraphics();
|
||||
Graphics* g = ev.graphics();
|
||||
|
||||
skin::Style::State state;
|
||||
if (hasMouseOver()) state += skin::Style::hover();
|
||||
if (m_withNotifications) state += skin::Style::active();
|
||||
if (isSelected()) state += skin::Style::clicked();
|
||||
m_flagStyle->paint(g, getClientBounds(), NULL, state);
|
||||
m_flagStyle->paint(g, clientBounds(), NULL, state);
|
||||
}
|
||||
|
||||
void Notifications::onClick(ui::Event& ev)
|
||||
@ -74,7 +74,7 @@ void Notifications::onClick(ui::Event& ev)
|
||||
m_withNotifications = false;
|
||||
invalidate();
|
||||
|
||||
gfx::Rect bounds = getBounds();
|
||||
gfx::Rect bounds = this->bounds();
|
||||
m_popup.showPopup(gfx::Point(
|
||||
bounds.x - m_popup.sizeHint().w,
|
||||
bounds.y + bounds.h));
|
||||
|
@ -184,7 +184,7 @@ int PaletteView::getSelectedEntriesCount() const
|
||||
|
||||
app::Color PaletteView::getColorByPosition(const gfx::Point& pos)
|
||||
{
|
||||
gfx::Point relPos = pos - getBounds().getOrigin();
|
||||
gfx::Point relPos = pos - bounds().origin();
|
||||
Palette* palette = currentPalette();
|
||||
for (int i=0; i<palette->size(); ++i) {
|
||||
if (getPaletteEntryBounds(i).contains(relPos))
|
||||
@ -395,7 +395,7 @@ bool PaletteView::onProcessMessage(Message* msg)
|
||||
setBoxSize(m_boxsize + z);
|
||||
}
|
||||
else {
|
||||
gfx::Point scroll = view->getViewScroll();
|
||||
gfx::Point scroll = view->viewScroll();
|
||||
scroll += delta * 3 * m_boxsize;
|
||||
view->setViewScroll(scroll);
|
||||
}
|
||||
@ -410,7 +410,7 @@ bool PaletteView::onProcessMessage(Message* msg)
|
||||
|
||||
case kSetCursorMessage: {
|
||||
MouseMessage* mouseMsg = static_cast<MouseMessage*>(msg);
|
||||
Hit hit = hitTest(mouseMsg->position() - getBounds().getOrigin());
|
||||
Hit hit = hitTest(mouseMsg->position() - bounds().origin());
|
||||
if (hit != m_hot) {
|
||||
m_hot = hit;
|
||||
invalidate();
|
||||
@ -426,10 +426,10 @@ bool PaletteView::onProcessMessage(Message* msg)
|
||||
|
||||
void PaletteView::onPaint(ui::PaintEvent& ev)
|
||||
{
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
int outlineWidth = theme->dimensions.paletteOutlineWidth();
|
||||
ui::Graphics* g = ev.getGraphics();
|
||||
gfx::Rect bounds = getClientBounds();
|
||||
ui::Graphics* g = ev.graphics();
|
||||
gfx::Rect bounds = clientBounds();
|
||||
Palette* palette = currentPalette();
|
||||
int fgIndex = -1;
|
||||
int bgIndex = -1;
|
||||
@ -477,7 +477,7 @@ void PaletteView::onPaint(ui::PaintEvent& ev)
|
||||
case SelectOneColor:
|
||||
if (m_currentEntry == i)
|
||||
g->fillRect(color_utils::blackandwhite_neg(gfxColor),
|
||||
gfx::Rect(box.getCenter(), gfx::Size(1, 1)));
|
||||
gfx::Rect(box.center(), gfx::Size(1, 1)));
|
||||
break;
|
||||
|
||||
case FgBgColors:
|
||||
@ -495,7 +495,7 @@ void PaletteView::onPaint(ui::PaintEvent& ev)
|
||||
|
||||
if (transparentIndex == i)
|
||||
g->fillRect(color_utils::blackandwhite_neg(gfxColor),
|
||||
gfx::Rect(box.getCenter(), gfx::Size(1, 1)));
|
||||
gfx::Rect(box.center(), gfx::Size(1, 1)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -503,7 +503,7 @@ void PaletteView::onPaint(ui::PaintEvent& ev)
|
||||
// Handle to resize palette
|
||||
|
||||
if (m_editable && !dragging) {
|
||||
she::Surface* handle = theme->parts.palResize()->getBitmap(0);
|
||||
she::Surface* handle = theme->parts.palResize()->bitmap(0);
|
||||
gfx::Rect box = getPaletteEntryBounds(palSize);
|
||||
g->drawRgbaSurface(handle,
|
||||
box.x+box.w/2-handle->width()/2,
|
||||
@ -589,7 +589,7 @@ void PaletteView::onResize(ui::ResizeEvent& ev)
|
||||
View* view = View::getView(this);
|
||||
if (view) {
|
||||
int columns =
|
||||
(view->getViewportBounds().w-this->childSpacing()*2)
|
||||
(view->viewportBounds().w-this->childSpacing()*2)
|
||||
/ (m_boxsize+this->childSpacing());
|
||||
setColumns(MAX(1, columns));
|
||||
}
|
||||
@ -627,12 +627,12 @@ void PaletteView::update_scroll(int color)
|
||||
if (!view)
|
||||
return;
|
||||
|
||||
gfx::Rect vp = view->getViewportBounds();
|
||||
gfx::Rect vp = view->viewportBounds();
|
||||
gfx::Point scroll;
|
||||
int x, y, cols;
|
||||
div_t d;
|
||||
|
||||
scroll = view->getViewScroll();
|
||||
scroll = view->viewScroll();
|
||||
|
||||
d = div(currentPalette()->size(), m_columns);
|
||||
cols = m_columns;
|
||||
@ -664,7 +664,7 @@ void PaletteView::onAppPaletteChange()
|
||||
|
||||
gfx::Rect PaletteView::getPaletteEntryBounds(int index) const
|
||||
{
|
||||
gfx::Rect bounds = getClientBounds();
|
||||
gfx::Rect bounds = clientBounds();
|
||||
int cols = m_columns;
|
||||
int col = index % cols;
|
||||
int row = index / cols;
|
||||
@ -677,7 +677,7 @@ gfx::Rect PaletteView::getPaletteEntryBounds(int index) const
|
||||
|
||||
PaletteView::Hit PaletteView::hitTest(const gfx::Point& pos)
|
||||
{
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
int outlineWidth = theme->dimensions.paletteOutlineWidth();
|
||||
Palette* palette = currentPalette();
|
||||
|
||||
@ -711,7 +711,7 @@ PaletteView::Hit PaletteView::hitTest(const gfx::Point& pos)
|
||||
|
||||
// Check if we are inside a color.
|
||||
View* view = View::getView(this);
|
||||
gfx::Rect vp = view->getViewportBounds();
|
||||
gfx::Rect vp = view->viewportBounds();
|
||||
for (int i=0; ; ++i) {
|
||||
gfx::Rect box = getPaletteEntryBounds(i);
|
||||
if (i >= palette->size() && box.y2() > vp.h)
|
||||
@ -972,7 +972,7 @@ void PaletteView::setNewPalette(doc::Palette* oldPalette,
|
||||
}
|
||||
|
||||
set_current_palette(newPalette, false);
|
||||
getManager()->invalidate();
|
||||
manager()->invalidate();
|
||||
}
|
||||
|
||||
gfx::Color PaletteView::drawEntry(ui::Graphics* g, const gfx::Rect& box, int palIdx)
|
||||
|
@ -47,7 +47,7 @@ void PopupWindowPin::onPinClick(Event& ev)
|
||||
makeFloating();
|
||||
}
|
||||
else {
|
||||
gfx::Rect rc = getBounds();
|
||||
gfx::Rect rc = bounds();
|
||||
rc.enlarge(8);
|
||||
setHotRegion(gfx::Region(rc));
|
||||
makeFixed();
|
||||
@ -76,11 +76,11 @@ void PopupWindowPin::onHitTest(HitTestEvent& ev)
|
||||
{
|
||||
PopupWindow::onHitTest(ev);
|
||||
|
||||
if (m_pin.isSelected() &&
|
||||
ev.getHit() == HitTestClient) {
|
||||
if (ev.getPoint().x <= getBounds().x+2)
|
||||
if ((m_pin.isSelected()) &&
|
||||
(ev.hit() == HitTestClient)) {
|
||||
if (ev.point().x <= bounds().x+2)
|
||||
ev.setHit(HitTestBorderW);
|
||||
else if (ev.getPoint().x >= getBounds().x2()-3)
|
||||
else if (ev.point().x >= bounds().x2()-3)
|
||||
ev.setHit(HitTestBorderE);
|
||||
else
|
||||
ev.setHit(HitTestCaption);
|
||||
|
@ -57,19 +57,19 @@ public:
|
||||
|
||||
protected:
|
||||
void onSetDecorativeWidgetBounds() override {
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
Widget* window = getParent();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
Widget* window = parent();
|
||||
gfx::Rect rect(0, 0, 0, 0);
|
||||
gfx::Size iconSize = theme->parts.windowPlayButtonNormal()->getSize();
|
||||
gfx::Size closeSize = theme->parts.windowCloseButtonNormal()->getSize();
|
||||
gfx::Size iconSize = theme->parts.windowPlayButtonNormal()->size();
|
||||
gfx::Size closeSize = theme->parts.windowCloseButtonNormal()->size();
|
||||
|
||||
rect.w = iconSize.w;
|
||||
rect.h = iconSize.h;
|
||||
|
||||
rect.offset(window->getBounds().x2() - 3*guiscale()
|
||||
rect.offset(window->bounds().x2() - 3*guiscale()
|
||||
- iconSize.w - 1*guiscale()
|
||||
- iconSize.w - 1*guiscale() - closeSize.w,
|
||||
window->getBounds().y + 3*guiscale());
|
||||
window->bounds().y + 3*guiscale());
|
||||
|
||||
setBounds(rect);
|
||||
}
|
||||
@ -113,18 +113,18 @@ private:
|
||||
}
|
||||
|
||||
void onSetDecorativeWidgetBounds() override {
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
Widget* window = getParent();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
Widget* window = parent();
|
||||
gfx::Rect rect(0, 0, 0, 0);
|
||||
gfx::Size playSize = theme->parts.windowPlayButtonNormal()->getSize();
|
||||
gfx::Size closeSize = theme->parts.windowCloseButtonNormal()->getSize();
|
||||
gfx::Size playSize = theme->parts.windowPlayButtonNormal()->size();
|
||||
gfx::Size closeSize = theme->parts.windowCloseButtonNormal()->size();
|
||||
|
||||
rect.w = playSize.w;
|
||||
rect.h = playSize.h;
|
||||
|
||||
rect.offset(window->getBounds().x2() - 3*guiscale()
|
||||
rect.offset(window->bounds().x2() - 3*guiscale()
|
||||
- playSize.w - 1*guiscale() - closeSize.w,
|
||||
window->getBounds().y + 3*guiscale());
|
||||
window->bounds().y + 3*guiscale());
|
||||
|
||||
setBounds(rect);
|
||||
}
|
||||
@ -219,8 +219,8 @@ bool PreviewEditorWindow::onProcessMessage(ui::Message* msg)
|
||||
int extra = 2*theme->dimensions.miniScrollbarSize();
|
||||
setBounds(
|
||||
gfx::Rect(
|
||||
ui::display_w() - width - ToolBar::instance()->getBounds().w - extra,
|
||||
ui::display_h() - height - StatusBar::instance()->getBounds().h - extra,
|
||||
ui::display_w() - width - ToolBar::instance()->bounds().w - extra,
|
||||
ui::display_h() - height - StatusBar::instance()->bounds().h - extra,
|
||||
width, height));
|
||||
|
||||
load_window_pos(this, "MiniEditor");
|
||||
@ -241,7 +241,7 @@ void PreviewEditorWindow::onClose(ui::CloseEvent& ev)
|
||||
{
|
||||
Button* closeButton = dynamic_cast<Button*>(ev.getSource());
|
||||
if (closeButton != NULL &&
|
||||
closeButton->getId() == SkinTheme::kThemeCloseButtonId) {
|
||||
closeButton->id() == SkinTheme::kThemeCloseButtonId) {
|
||||
// Here we don't use "setMiniEditorEnabled" to change the state of
|
||||
// "m_isEnabled" because we're coming from a close event of the
|
||||
// window.
|
||||
@ -318,7 +318,7 @@ void PreviewEditorWindow::updateUsingEditor(Editor* editor)
|
||||
openWindow();
|
||||
|
||||
gfx::Rect visibleBounds = editor->getVisibleSpriteBounds();
|
||||
gfx::Point centerPoint = visibleBounds.getCenter();
|
||||
gfx::Point centerPoint = visibleBounds.center();
|
||||
bool center = (m_centerButton->isSelected());
|
||||
|
||||
// Set the same location as in the given editor.
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
|
||||
protected:
|
||||
void onSizeHint(SizeHintEvent& ev) override {
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
Style* style = theme->styles.recentFile();
|
||||
Style* styleDetail = theme->styles.recentFileDetail();
|
||||
Style::State state;
|
||||
@ -55,16 +55,16 @@ protected:
|
||||
}
|
||||
|
||||
void onPaint(PaintEvent& ev) override {
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
Graphics* g = ev.getGraphics();
|
||||
gfx::Rect bounds = getClientBounds();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
Graphics* g = ev.graphics();
|
||||
gfx::Rect bounds = clientBounds();
|
||||
Style* style = theme->styles.recentFile();
|
||||
Style* styleDetail = theme->styles.recentFileDetail();
|
||||
|
||||
Style::State state;
|
||||
if (hasMouse() && !getManager()->getCapture()) state += Style::hover();
|
||||
if (hasMouse() && !manager()->getCapture()) state += Style::hover();
|
||||
if (isSelected()) state += Style::active();
|
||||
if (getParent()->hasCapture()) state += Style::clicked();
|
||||
if (parent()->hasCapture()) state += Style::clicked();
|
||||
|
||||
std::string name = this->name();
|
||||
style->paint(g, bounds, name.c_str(), state);
|
||||
@ -77,12 +77,12 @@ protected:
|
||||
}
|
||||
|
||||
void onClick() override {
|
||||
static_cast<RecentListBox*>(getParent())->onClick(getText());
|
||||
static_cast<RecentListBox*>(parent())->onClick(text());
|
||||
}
|
||||
|
||||
private:
|
||||
std::string name() const { return base::get_file_name(getText()); }
|
||||
std::string path() const { return base::get_file_path(getText()); }
|
||||
std::string name() const { return base::get_file_name(text()); }
|
||||
std::string path() const { return base::get_file_path(text()); }
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
@ -97,8 +97,8 @@ RecentListBox::RecentListBox()
|
||||
|
||||
void RecentListBox::rebuildList()
|
||||
{
|
||||
while (getLastChild())
|
||||
removeChild(getLastChild());
|
||||
while (lastChild())
|
||||
removeChild(lastChild());
|
||||
|
||||
onRebuildList();
|
||||
|
||||
|
@ -49,9 +49,9 @@ protected:
|
||||
}
|
||||
|
||||
void onPaint(PaintEvent& ev) override {
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
Graphics* g = ev.getGraphics();
|
||||
gfx::Rect bounds = getClientBounds();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
Graphics* g = ev.graphics();
|
||||
gfx::Rect bounds = clientBounds();
|
||||
gfx::Color bgcolor, fgcolor;
|
||||
|
||||
if (isSelected()) {
|
||||
@ -65,7 +65,7 @@ protected:
|
||||
|
||||
g->fillRect(bgcolor, bounds);
|
||||
|
||||
static_cast<ResourcesListBox*>(getParent())->
|
||||
static_cast<ResourcesListBox*>(parent())->
|
||||
paintResource(g, bounds, m_resource);
|
||||
|
||||
// for (int i=0; i<m_palette->size(); ++i) {
|
||||
@ -79,15 +79,15 @@ protected:
|
||||
// box.x += box.w;
|
||||
// }
|
||||
|
||||
g->drawString(getText(), fgcolor, gfx::ColorNone,
|
||||
g->drawString(text(), fgcolor, gfx::ColorNone,
|
||||
gfx::Point(
|
||||
bounds.x + guiscale()*2,
|
||||
bounds.y + bounds.h/2 - g->measureUIString(getText()).h/2));
|
||||
bounds.y + bounds.h/2 - g->measureUIString(text()).h/2));
|
||||
}
|
||||
|
||||
void onSizeHint(SizeHintEvent& ev) override {
|
||||
ev.setSizeHint(
|
||||
static_cast<ResourcesListBox*>(getParent())->
|
||||
static_cast<ResourcesListBox*>(parent())->
|
||||
resourceSizeHint(m_resource));
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ bool SearchEntry::onProcessMessage(ui::Message* msg)
|
||||
case kMouseDownMessage: {
|
||||
Rect closeBounds = getCloseIconBounds();
|
||||
Point mousePos = static_cast<MouseMessage*>(msg)->position()
|
||||
- getBounds().getOrigin();
|
||||
- bounds().origin();
|
||||
|
||||
if (closeBounds.contains(mousePos)) {
|
||||
setText("");
|
||||
@ -50,19 +50,19 @@ bool SearchEntry::onProcessMessage(ui::Message* msg)
|
||||
|
||||
void SearchEntry::onPaint(ui::PaintEvent& ev)
|
||||
{
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
theme->paintEntry(ev);
|
||||
|
||||
auto icon = theme->parts.iconSearch()->getBitmap(0);
|
||||
Rect bounds = getClientBounds();
|
||||
ev.getGraphics()->drawColoredRgbaSurface(
|
||||
auto icon = theme->parts.iconSearch()->bitmap(0);
|
||||
Rect bounds = clientBounds();
|
||||
ev.graphics()->drawColoredRgbaSurface(
|
||||
icon, theme->colors.text(),
|
||||
bounds.x + border().left(),
|
||||
bounds.y + bounds.h/2 - icon->height()/2);
|
||||
|
||||
if (!getText().empty()) {
|
||||
icon = theme->parts.iconClose()->getBitmap(0);
|
||||
ev.getGraphics()->drawColoredRgbaSurface(
|
||||
if (!text().empty()) {
|
||||
icon = theme->parts.iconClose()->bitmap(0);
|
||||
ev.graphics()->drawColoredRgbaSurface(
|
||||
icon, theme->colors.text(),
|
||||
bounds.x + bounds.w - border().right() - childSpacing() - icon->width(),
|
||||
bounds.y + bounds.h/2 - icon->height()/2);
|
||||
@ -74,8 +74,8 @@ void SearchEntry::onSizeHint(SizeHintEvent& ev)
|
||||
Entry::onSizeHint(ev);
|
||||
Size sz = ev.sizeHint();
|
||||
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
auto icon = theme->parts.iconSearch()->getBitmap(0);
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
auto icon = theme->parts.iconSearch()->bitmap(0);
|
||||
sz.h = MAX(sz.h, icon->height()+border().height());
|
||||
|
||||
ev.setSizeHint(sz);
|
||||
@ -83,10 +83,10 @@ void SearchEntry::onSizeHint(SizeHintEvent& ev)
|
||||
|
||||
Rect SearchEntry::onGetEntryTextBounds() const
|
||||
{
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
Rect bounds = Entry::onGetEntryTextBounds();
|
||||
auto icon1 = theme->parts.iconSearch()->getBitmap(0);
|
||||
auto icon2 = theme->parts.iconClose()->getBitmap(0);
|
||||
auto icon1 = theme->parts.iconSearch()->bitmap(0);
|
||||
auto icon2 = theme->parts.iconClose()->bitmap(0);
|
||||
bounds.x += childSpacing() + icon1->width();
|
||||
bounds.w -= 2*childSpacing() + icon1->width() + icon2->width();
|
||||
return bounds;
|
||||
@ -94,9 +94,9 @@ Rect SearchEntry::onGetEntryTextBounds() const
|
||||
|
||||
Rect SearchEntry::getCloseIconBounds() const
|
||||
{
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
Rect bounds = getClientBounds();
|
||||
auto icon = theme->parts.iconClose()->getBitmap(0);
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
Rect bounds = clientBounds();
|
||||
auto icon = theme->parts.iconClose()->bitmap(0);
|
||||
bounds.x += bounds.w - border().right() - childSpacing() - icon->width();
|
||||
bounds.y += bounds.h/2 - icon->height()/2;
|
||||
bounds.w = icon->width();
|
||||
|
@ -34,27 +34,27 @@ void ButtonIconImpl::destroy()
|
||||
delete this;
|
||||
}
|
||||
|
||||
gfx::Size ButtonIconImpl::getSize()
|
||||
gfx::Size ButtonIconImpl::size()
|
||||
{
|
||||
return m_normalIcon ? m_normalIcon->getSize(): gfx::Size(0, 0);
|
||||
return m_normalIcon ? m_normalIcon->size(): gfx::Size(0, 0);
|
||||
}
|
||||
|
||||
she::Surface* ButtonIconImpl::getNormalIcon()
|
||||
she::Surface* ButtonIconImpl::normalIcon()
|
||||
{
|
||||
return m_normalIcon ? m_normalIcon->getBitmap(0): nullptr;
|
||||
return m_normalIcon ? m_normalIcon->bitmap(0): nullptr;
|
||||
}
|
||||
|
||||
she::Surface* ButtonIconImpl::getSelectedIcon()
|
||||
she::Surface* ButtonIconImpl::selectedIcon()
|
||||
{
|
||||
return m_selectedIcon ? m_selectedIcon->getBitmap(0): nullptr;
|
||||
return m_selectedIcon ? m_selectedIcon->bitmap(0): nullptr;
|
||||
}
|
||||
|
||||
she::Surface* ButtonIconImpl::getDisabledIcon()
|
||||
she::Surface* ButtonIconImpl::disabledIcon()
|
||||
{
|
||||
return m_disabledIcon ? m_disabledIcon->getBitmap(0): nullptr;
|
||||
return m_disabledIcon ? m_disabledIcon->bitmap(0): nullptr;
|
||||
}
|
||||
|
||||
int ButtonIconImpl::getIconAlign()
|
||||
int ButtonIconImpl::iconAlign()
|
||||
{
|
||||
return m_iconAlign;
|
||||
}
|
||||
|
@ -26,11 +26,11 @@ namespace app {
|
||||
|
||||
// IButtonIcon implementation
|
||||
void destroy();
|
||||
gfx::Size getSize();
|
||||
she::Surface* getNormalIcon();
|
||||
she::Surface* getSelectedIcon();
|
||||
she::Surface* getDisabledIcon();
|
||||
int getIconAlign();
|
||||
gfx::Size size();
|
||||
she::Surface* normalIcon();
|
||||
she::Surface* selectedIcon();
|
||||
she::Surface* disabledIcon();
|
||||
int iconAlign();
|
||||
|
||||
public:
|
||||
SkinPartPtr m_normalIcon;
|
||||
|
@ -41,8 +41,8 @@ namespace app {
|
||||
|
||||
protected:
|
||||
void onPaint(ui::PaintEvent& ev) override {
|
||||
gfx::Rect bounds(Base::getClientBounds());
|
||||
ui::Graphics* g = ev.getGraphics();
|
||||
gfx::Rect bounds(Base::clientBounds());
|
||||
ui::Graphics* g = ev.graphics();
|
||||
SkinPartPtr part;
|
||||
|
||||
if (Base::isSelected())
|
||||
@ -52,7 +52,7 @@ namespace app {
|
||||
else
|
||||
part = m_partNormal;
|
||||
|
||||
g->drawRgbaSurface(part->getBitmap(0), bounds.x, bounds.y);
|
||||
g->drawRgbaSurface(part->bitmap(0), bounds.x, bounds.y);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -44,7 +44,7 @@ void SkinPart::setBitmap(std::size_t index, she::Surface* bitmap)
|
||||
m_bitmaps[index] = bitmap;
|
||||
}
|
||||
|
||||
gfx::Size SkinPart::getSize() const
|
||||
gfx::Size SkinPart::size() const
|
||||
{
|
||||
if (!m_bitmaps.empty())
|
||||
return gfx::Size(m_bitmaps[0]->width(),
|
||||
|
@ -34,20 +34,20 @@ namespace app {
|
||||
// It doesn't destroy the previous bitmap in the given "index".
|
||||
void setBitmap(std::size_t index, she::Surface* bitmap);
|
||||
|
||||
she::Surface* getBitmap(std::size_t index) const {
|
||||
she::Surface* bitmap(std::size_t index) const {
|
||||
return (index < m_bitmaps.size() ? m_bitmaps[index]: NULL);
|
||||
}
|
||||
|
||||
she::Surface* getBitmapNW() const { return getBitmap(0); }
|
||||
she::Surface* getBitmapN() const { return getBitmap(1); }
|
||||
she::Surface* getBitmapNE() const { return getBitmap(2); }
|
||||
she::Surface* getBitmapE() const { return getBitmap(3); }
|
||||
she::Surface* getBitmapSE() const { return getBitmap(4); }
|
||||
she::Surface* getBitmapS() const { return getBitmap(5); }
|
||||
she::Surface* getBitmapSW() const { return getBitmap(6); }
|
||||
she::Surface* getBitmapW() const { return getBitmap(7); }
|
||||
she::Surface* bitmapNW() const { return bitmap(0); }
|
||||
she::Surface* bitmapN() const { return bitmap(1); }
|
||||
she::Surface* bitmapNE() const { return bitmap(2); }
|
||||
she::Surface* bitmapE() const { return bitmap(3); }
|
||||
she::Surface* bitmapSE() const { return bitmap(4); }
|
||||
she::Surface* bitmapS() const { return bitmap(5); }
|
||||
she::Surface* bitmapSW() const { return bitmap(6); }
|
||||
she::Surface* bitmapW() const { return bitmap(7); }
|
||||
|
||||
gfx::Size getSize() const;
|
||||
gfx::Size size() const;
|
||||
|
||||
private:
|
||||
Bitmaps m_bitmaps;
|
||||
|
@ -67,7 +67,7 @@ protected:
|
||||
}
|
||||
|
||||
void onPaint(PaintEvent& ev) override {
|
||||
static_cast<SkinTheme*>(getTheme())->paintWindowButton(ev);
|
||||
static_cast<SkinTheme*>(theme())->paintWindowButton(ev);
|
||||
}
|
||||
|
||||
bool onProcessMessage(Message* msg) override {
|
||||
@ -78,7 +78,7 @@ protected:
|
||||
return true;
|
||||
|
||||
case kKeyDownMessage:
|
||||
if (getRoot()->isForeground() &&
|
||||
if (window()->isForeground() &&
|
||||
static_cast<KeyMessage*>(msg)->scancode() == kKeyEsc) {
|
||||
setSelected(true);
|
||||
return true;
|
||||
@ -86,7 +86,7 @@ protected:
|
||||
break;
|
||||
|
||||
case kKeyUpMessage:
|
||||
if (getRoot()->isForeground() &&
|
||||
if (window()->isForeground() &&
|
||||
static_cast<KeyMessage*>(msg)->scancode() == kKeyEsc) {
|
||||
if (isSelected()) {
|
||||
setSelected(false);
|
||||
@ -138,7 +138,7 @@ static const char* cursor_names[kCursorTypes] = {
|
||||
// static
|
||||
SkinTheme* SkinTheme::instance()
|
||||
{
|
||||
return static_cast<SkinTheme*>(ui::Manager::getDefault()->getTheme());
|
||||
return static_cast<SkinTheme*>(ui::Manager::getDefault()->theme());
|
||||
}
|
||||
|
||||
SkinTheme::SkinTheme()
|
||||
@ -372,7 +372,7 @@ void SkinTheme::loadXml(const std::string& skinId)
|
||||
|
||||
if (w > 0 && h > 0) {
|
||||
part->setBitmap(0,
|
||||
sliceSheet(part->getBitmap(0), gfx::Rect(x, y, w, h)));
|
||||
sliceSheet(part->bitmap(0), gfx::Rect(x, y, w, h)));
|
||||
}
|
||||
else if (xmlPart->Attribute("w1")) { // 3x3-1 part (NW, N, NE, E, SE, S, SW, W)
|
||||
int w1 = strtol(xmlPart->Attribute("w1"), NULL, 10);
|
||||
@ -382,14 +382,14 @@ void SkinTheme::loadXml(const std::string& skinId)
|
||||
int h2 = strtol(xmlPart->Attribute("h2"), NULL, 10);
|
||||
int h3 = strtol(xmlPart->Attribute("h3"), NULL, 10);
|
||||
|
||||
part->setBitmap(0, sliceSheet(part->getBitmap(0), gfx::Rect(x, y, w1, h1))); // NW
|
||||
part->setBitmap(1, sliceSheet(part->getBitmap(1), gfx::Rect(x+w1, y, w2, h1))); // N
|
||||
part->setBitmap(2, sliceSheet(part->getBitmap(2), gfx::Rect(x+w1+w2, y, w3, h1))); // NE
|
||||
part->setBitmap(3, sliceSheet(part->getBitmap(3), gfx::Rect(x+w1+w2, y+h1, w3, h2))); // E
|
||||
part->setBitmap(4, sliceSheet(part->getBitmap(4), gfx::Rect(x+w1+w2, y+h1+h2, w3, h3))); // SE
|
||||
part->setBitmap(5, sliceSheet(part->getBitmap(5), gfx::Rect(x+w1, y+h1+h2, w2, h3))); // S
|
||||
part->setBitmap(6, sliceSheet(part->getBitmap(6), gfx::Rect(x, y+h1+h2, w1, h3))); // SW
|
||||
part->setBitmap(7, sliceSheet(part->getBitmap(7), gfx::Rect(x, y+h1, w1, h2))); // W
|
||||
part->setBitmap(0, sliceSheet(part->bitmap(0), gfx::Rect(x, y, w1, h1))); // NW
|
||||
part->setBitmap(1, sliceSheet(part->bitmap(1), gfx::Rect(x+w1, y, w2, h1))); // N
|
||||
part->setBitmap(2, sliceSheet(part->bitmap(2), gfx::Rect(x+w1+w2, y, w3, h1))); // NE
|
||||
part->setBitmap(3, sliceSheet(part->bitmap(3), gfx::Rect(x+w1+w2, y+h1, w3, h2))); // E
|
||||
part->setBitmap(4, sliceSheet(part->bitmap(4), gfx::Rect(x+w1+w2, y+h1+h2, w3, h3))); // SE
|
||||
part->setBitmap(5, sliceSheet(part->bitmap(5), gfx::Rect(x+w1, y+h1+h2, w2, h3))); // S
|
||||
part->setBitmap(6, sliceSheet(part->bitmap(6), gfx::Rect(x, y+h1+h2, w1, h3))); // SW
|
||||
part->setBitmap(7, sliceSheet(part->bitmap(7), gfx::Rect(x, y+h1, w1, h2))); // W
|
||||
}
|
||||
|
||||
xmlPart = xmlPart->NextSiblingElement();
|
||||
@ -544,10 +544,10 @@ void SkinTheme::initWidget(Widget* widget)
|
||||
|
||||
case kButtonWidget:
|
||||
BORDER4(
|
||||
parts.buttonNormal()->getBitmapW()->width(),
|
||||
parts.buttonNormal()->getBitmapN()->height(),
|
||||
parts.buttonNormal()->getBitmapE()->width(),
|
||||
parts.buttonNormal()->getBitmapS()->height());
|
||||
parts.buttonNormal()->bitmapW()->width(),
|
||||
parts.buttonNormal()->bitmapN()->height(),
|
||||
parts.buttonNormal()->bitmapE()->width(),
|
||||
parts.buttonNormal()->bitmapS()->height());
|
||||
widget->setChildSpacing(0);
|
||||
break;
|
||||
|
||||
@ -564,10 +564,10 @@ void SkinTheme::initWidget(Widget* widget)
|
||||
|
||||
case kEntryWidget:
|
||||
BORDER4(
|
||||
parts.sunkenNormal()->getBitmapW()->width(),
|
||||
parts.sunkenNormal()->getBitmapN()->height(),
|
||||
parts.sunkenNormal()->getBitmapE()->width(),
|
||||
parts.sunkenNormal()->getBitmapS()->height());
|
||||
parts.sunkenNormal()->bitmapW()->width(),
|
||||
parts.sunkenNormal()->bitmapN()->height(),
|
||||
parts.sunkenNormal()->bitmapE()->width(),
|
||||
parts.sunkenNormal()->bitmapS()->height());
|
||||
widget->setChildSpacing(3 * scale);
|
||||
break;
|
||||
|
||||
@ -639,12 +639,12 @@ void SkinTheme::initWidget(Widget* widget)
|
||||
|
||||
case kSeparatorWidget:
|
||||
// Frame
|
||||
if ((widget->getAlign() & HORIZONTAL) &&
|
||||
(widget->getAlign() & VERTICAL)) {
|
||||
if ((widget->align() & HORIZONTAL) &&
|
||||
(widget->align() & VERTICAL)) {
|
||||
BORDER(4 * scale);
|
||||
}
|
||||
// Horizontal bar
|
||||
else if (widget->getAlign() & HORIZONTAL) {
|
||||
else if (widget->align() & HORIZONTAL) {
|
||||
BORDER4(2 * scale, 4 * scale, 2 * scale, 0);
|
||||
}
|
||||
// Vertical bar
|
||||
@ -655,11 +655,11 @@ void SkinTheme::initWidget(Widget* widget)
|
||||
|
||||
case kSliderWidget:
|
||||
BORDER4(
|
||||
parts.sliderEmpty()->getBitmapW()->width()-1*scale,
|
||||
parts.sliderEmpty()->getBitmapN()->height(),
|
||||
parts.sliderEmpty()->getBitmapE()->width()-1*scale,
|
||||
parts.sliderEmpty()->getBitmapS()->height()-1*scale);
|
||||
widget->setChildSpacing(widget->getTextHeight());
|
||||
parts.sliderEmpty()->bitmapW()->width()-1*scale,
|
||||
parts.sliderEmpty()->bitmapN()->height(),
|
||||
parts.sliderEmpty()->bitmapE()->width()-1*scale,
|
||||
parts.sliderEmpty()->bitmapS()->height()-1*scale);
|
||||
widget->setChildSpacing(widget->textHeight());
|
||||
widget->setAlign(CENTER | MIDDLE);
|
||||
break;
|
||||
|
||||
@ -670,10 +670,10 @@ void SkinTheme::initWidget(Widget* widget)
|
||||
|
||||
case kViewWidget:
|
||||
BORDER4(
|
||||
parts.sunkenNormal()->getBitmapW()->width()-1*scale,
|
||||
parts.sunkenNormal()->getBitmapN()->height(),
|
||||
parts.sunkenNormal()->getBitmapE()->width()-1*scale,
|
||||
parts.sunkenNormal()->getBitmapS()->height()-1*scale);
|
||||
parts.sunkenNormal()->bitmapW()->width()-1*scale,
|
||||
parts.sunkenNormal()->bitmapN()->height(),
|
||||
parts.sunkenNormal()->bitmapE()->width()-1*scale,
|
||||
parts.sunkenNormal()->bitmapS()->height()-1*scale);
|
||||
widget->setChildSpacing(0);
|
||||
widget->setBgColor(colors.windowFace());
|
||||
break;
|
||||
@ -692,7 +692,7 @@ void SkinTheme::initWidget(Widget* widget)
|
||||
if (!static_cast<Window*>(widget)->isDesktop()) {
|
||||
if (widget->hasText()) {
|
||||
BORDER4(6 * scale,
|
||||
(4+6) * scale + widget->getTextHeight(),
|
||||
(4+6) * scale + widget->textHeight(),
|
||||
6 * scale,
|
||||
6 * scale);
|
||||
|
||||
@ -719,17 +719,17 @@ void SkinTheme::initWidget(Widget* widget)
|
||||
|
||||
void SkinTheme::getWindowMask(Widget* widget, Region& region)
|
||||
{
|
||||
region = widget->getBounds();
|
||||
region = widget->bounds();
|
||||
}
|
||||
|
||||
void SkinTheme::setDecorativeWidgetBounds(Widget* widget)
|
||||
{
|
||||
if (widget->getId() == kThemeCloseButtonId) {
|
||||
Widget* window = widget->getParent();
|
||||
gfx::Rect rect(parts.windowCloseButtonNormal()->getSize());
|
||||
if (widget->id() == kThemeCloseButtonId) {
|
||||
Widget* window = widget->parent();
|
||||
gfx::Rect rect(parts.windowCloseButtonNormal()->size());
|
||||
|
||||
rect.offset(window->getBounds().x2() - 3*guiscale() - rect.w,
|
||||
window->getBounds().y + 3*guiscale());
|
||||
rect.offset(window->bounds().x2() - 3*guiscale() - rect.w,
|
||||
window->bounds().y + 3*guiscale());
|
||||
|
||||
widget->setBounds(rect);
|
||||
}
|
||||
@ -742,7 +742,7 @@ int SkinTheme::getScrollbarSize()
|
||||
|
||||
void SkinTheme::paintDesktop(PaintEvent& ev)
|
||||
{
|
||||
Graphics* g = ev.getGraphics();
|
||||
Graphics* g = ev.graphics();
|
||||
|
||||
g->fillRect(colors.disabled(), g->getClipBounds());
|
||||
}
|
||||
@ -750,7 +750,7 @@ void SkinTheme::paintDesktop(PaintEvent& ev)
|
||||
void SkinTheme::paintBox(PaintEvent& ev)
|
||||
{
|
||||
Widget* widget = static_cast<Widget*>(ev.getSource());
|
||||
Graphics* g = ev.getGraphics();
|
||||
Graphics* g = ev.graphics();
|
||||
|
||||
if (!is_transparent(BGCOLOR))
|
||||
g->fillRect(BGCOLOR, g->getClipBounds());
|
||||
@ -758,17 +758,17 @@ void SkinTheme::paintBox(PaintEvent& ev)
|
||||
|
||||
void SkinTheme::paintButton(PaintEvent& ev)
|
||||
{
|
||||
Graphics* g = ev.getGraphics();
|
||||
Graphics* g = ev.graphics();
|
||||
ButtonBase* widget = static_cast<ButtonBase*>(ev.getSource());
|
||||
IButtonIcon* iconInterface = widget->getIconInterface();
|
||||
IButtonIcon* iconInterface = widget->iconInterface();
|
||||
gfx::Rect box, text, icon;
|
||||
gfx::Color fg, bg;
|
||||
SkinPartPtr part_nw;
|
||||
|
||||
widget->getTextIconInfo(&box, &text, &icon,
|
||||
iconInterface ? iconInterface->getIconAlign(): 0,
|
||||
iconInterface ? iconInterface->getSize().w: 0,
|
||||
iconInterface ? iconInterface->getSize().h: 0);
|
||||
iconInterface ? iconInterface->iconAlign(): 0,
|
||||
iconInterface ? iconInterface->size().w: 0,
|
||||
iconInterface ? iconInterface->size().h: 0);
|
||||
|
||||
// Tool buttons are smaller
|
||||
LookType look = NormalLook;
|
||||
@ -816,11 +816,11 @@ void SkinTheme::paintButton(PaintEvent& ev)
|
||||
|
||||
// draw borders
|
||||
if (part_nw)
|
||||
drawRect(g, widget->getClientBounds(), part_nw.get(), bg);
|
||||
drawRect(g, widget->clientBounds(), part_nw.get(), bg);
|
||||
|
||||
// text
|
||||
drawTextString(g, NULL, fg, ColorNone, widget,
|
||||
widget->getClientChildrenBounds(), get_button_selected_offset());
|
||||
widget->clientChildrenBounds(), get_button_selected_offset());
|
||||
|
||||
// Paint the icon
|
||||
if (iconInterface) {
|
||||
@ -828,23 +828,23 @@ void SkinTheme::paintButton(PaintEvent& ev)
|
||||
icon.offset(get_button_selected_offset(),
|
||||
get_button_selected_offset());
|
||||
|
||||
paintIcon(widget, ev.getGraphics(), iconInterface, icon.x, icon.y);
|
||||
paintIcon(widget, ev.graphics(), iconInterface, icon.x, icon.y);
|
||||
}
|
||||
}
|
||||
|
||||
void SkinTheme::paintCheckBox(PaintEvent& ev)
|
||||
{
|
||||
Graphics* g = ev.getGraphics();
|
||||
Graphics* g = ev.graphics();
|
||||
ButtonBase* widget = static_cast<ButtonBase*>(ev.getSource());
|
||||
gfx::Rect bounds = widget->getClientBounds();
|
||||
IButtonIcon* iconInterface = widget->getIconInterface();
|
||||
gfx::Rect bounds = widget->clientBounds();
|
||||
IButtonIcon* iconInterface = widget->iconInterface();
|
||||
gfx::Rect box, text, icon;
|
||||
gfx::Color bg;
|
||||
|
||||
widget->getTextIconInfo(&box, &text, &icon,
|
||||
iconInterface ? iconInterface->getIconAlign(): 0,
|
||||
iconInterface ? iconInterface->getSize().w: 0,
|
||||
iconInterface ? iconInterface->getSize().h: 0);
|
||||
iconInterface ? iconInterface->iconAlign(): 0,
|
||||
iconInterface ? iconInterface->size().w: 0,
|
||||
iconInterface ? iconInterface->size().h: 0);
|
||||
|
||||
// Check box look
|
||||
LookType look = NormalLook;
|
||||
@ -878,7 +878,7 @@ void SkinTheme::paintCheckBox(PaintEvent& ev)
|
||||
void SkinTheme::paintGrid(PaintEvent& ev)
|
||||
{
|
||||
Widget* widget = static_cast<Widget*>(ev.getSource());
|
||||
Graphics* g = ev.getGraphics();
|
||||
Graphics* g = ev.graphics();
|
||||
|
||||
if (!is_transparent(BGCOLOR))
|
||||
g->fillRect(BGCOLOR, g->getClipBounds());
|
||||
@ -886,12 +886,12 @@ void SkinTheme::paintGrid(PaintEvent& ev)
|
||||
|
||||
void SkinTheme::paintEntry(PaintEvent& ev)
|
||||
{
|
||||
Graphics* g = ev.getGraphics();
|
||||
Graphics* g = ev.graphics();
|
||||
Entry* widget = static_cast<Entry*>(ev.getSource());
|
||||
gfx::Rect bounds = widget->getClientBounds();
|
||||
gfx::Rect bounds = widget->clientBounds();
|
||||
bool password = widget->isPassword();
|
||||
int scroll, caret, state, selbeg, selend;
|
||||
const std::string& textString = widget->getText();
|
||||
const std::string& textString = widget->text();
|
||||
int c, ch, x, y, w;
|
||||
int caret_x;
|
||||
|
||||
@ -961,7 +961,7 @@ void SkinTheme::paintEntry(PaintEvent& ev)
|
||||
if (!widget->getSuffix().empty()) {
|
||||
Rect sufBounds(x, y,
|
||||
bounds.x2()-widget->childSpacing()*guiscale()-x,
|
||||
widget->getTextHeight());
|
||||
widget->textHeight());
|
||||
IntersectClip clip(g, sufBounds);
|
||||
if (clip) {
|
||||
drawTextString(
|
||||
@ -981,11 +981,11 @@ void SkinTheme::paintEntry(PaintEvent& ev)
|
||||
|
||||
void SkinTheme::paintLabel(PaintEvent& ev)
|
||||
{
|
||||
Graphics* g = ev.getGraphics();
|
||||
Graphics* g = ev.graphics();
|
||||
Label* widget = static_cast<Label*>(ev.getSource());
|
||||
Style* style = styles.label();
|
||||
gfx::Color bg = BGCOLOR;
|
||||
Rect text, rc = widget->getClientBounds();
|
||||
Rect text, rc = widget->clientBounds();
|
||||
|
||||
SkinStylePropertyPtr styleProp = widget->getProperty(SkinStyleProperty::Name);
|
||||
if (styleProp)
|
||||
@ -997,15 +997,15 @@ void SkinTheme::paintLabel(PaintEvent& ev)
|
||||
rc.shrink(widget->border());
|
||||
|
||||
widget->getTextIconInfo(NULL, &text);
|
||||
style->paint(g, text, widget->getText().c_str(), Style::State());
|
||||
style->paint(g, text, widget->text().c_str(), Style::State());
|
||||
}
|
||||
|
||||
void SkinTheme::paintLinkLabel(PaintEvent& ev)
|
||||
{
|
||||
Graphics* g = ev.getGraphics();
|
||||
Graphics* g = ev.graphics();
|
||||
Widget* widget = static_cast<Widget*>(ev.getSource());
|
||||
Style* style = styles.link();
|
||||
gfx::Rect bounds = widget->getClientBounds();
|
||||
gfx::Rect bounds = widget->clientBounds();
|
||||
gfx::Color bg = BGCOLOR;
|
||||
|
||||
SkinStylePropertyPtr styleProp = widget->getProperty(SkinStyleProperty::Name);
|
||||
@ -1017,12 +1017,12 @@ void SkinTheme::paintLinkLabel(PaintEvent& ev)
|
||||
if (widget->isSelected()) state += Style::clicked();
|
||||
|
||||
g->fillRect(bg, bounds);
|
||||
style->paint(g, bounds, widget->getText().c_str(), state);
|
||||
style->paint(g, bounds, widget->text().c_str(), state);
|
||||
}
|
||||
|
||||
void SkinTheme::paintListBox(PaintEvent& ev)
|
||||
{
|
||||
Graphics* g = ev.getGraphics();
|
||||
Graphics* g = ev.graphics();
|
||||
|
||||
g->fillRect(colors.background(), g->getClipBounds());
|
||||
}
|
||||
@ -1030,8 +1030,8 @@ void SkinTheme::paintListBox(PaintEvent& ev)
|
||||
void SkinTheme::paintListItem(ui::PaintEvent& ev)
|
||||
{
|
||||
Widget* widget = static_cast<Widget*>(ev.getSource());
|
||||
gfx::Rect bounds = widget->getClientBounds();
|
||||
Graphics* g = ev.getGraphics();
|
||||
gfx::Rect bounds = widget->clientBounds();
|
||||
Graphics* g = ev.graphics();
|
||||
gfx::Color fg, bg;
|
||||
|
||||
if (!widget->isEnabled()) {
|
||||
@ -1058,7 +1058,7 @@ void SkinTheme::paintListItem(ui::PaintEvent& ev)
|
||||
void SkinTheme::paintMenu(PaintEvent& ev)
|
||||
{
|
||||
Widget* widget = static_cast<Widget*>(ev.getSource());
|
||||
Graphics* g = ev.getGraphics();
|
||||
Graphics* g = ev.graphics();
|
||||
|
||||
g->fillRect(BGCOLOR, g->getClipBounds());
|
||||
}
|
||||
@ -1066,17 +1066,17 @@ void SkinTheme::paintMenu(PaintEvent& ev)
|
||||
void SkinTheme::paintMenuItem(ui::PaintEvent& ev)
|
||||
{
|
||||
int scale = guiscale();
|
||||
Graphics* g = ev.getGraphics();
|
||||
Graphics* g = ev.graphics();
|
||||
MenuItem* widget = static_cast<MenuItem*>(ev.getSource());
|
||||
gfx::Rect bounds = widget->getClientBounds();
|
||||
gfx::Rect bounds = widget->clientBounds();
|
||||
gfx::Color fg, bg;
|
||||
int c, bar;
|
||||
|
||||
// TODO ASSERT?
|
||||
if (!widget->getParent()->getParent())
|
||||
if (!widget->parent()->parent())
|
||||
return;
|
||||
|
||||
bar = (widget->getParent()->getParent()->type() == kMenuBarWidget);
|
||||
bar = (widget->parent()->parent()->type() == kMenuBarWidget);
|
||||
|
||||
// Colors
|
||||
if (!widget->isEnabled()) {
|
||||
@ -1105,8 +1105,8 @@ void SkinTheme::paintMenuItem(ui::PaintEvent& ev)
|
||||
if (widget->isSelected()) {
|
||||
she::Surface* icon =
|
||||
(widget->isEnabled() ?
|
||||
parts.checkSelected()->getBitmap(0):
|
||||
parts.checkDisabled()->getBitmap(0));
|
||||
parts.checkSelected()->bitmap(0):
|
||||
parts.checkDisabled()->bitmap(0));
|
||||
|
||||
int x = bounds.x+4*scale-icon->width()/2;
|
||||
int y = bounds.y+bounds.h/2-icon->height()/2;
|
||||
@ -1150,13 +1150,13 @@ void SkinTheme::paintMenuItem(ui::PaintEvent& ev)
|
||||
}
|
||||
// Draw the keyboard shortcut
|
||||
else if (AppMenuItem* appMenuItem = dynamic_cast<AppMenuItem*>(widget)) {
|
||||
if (appMenuItem->getKey() && !appMenuItem->getKey()->accels().empty()) {
|
||||
int old_align = appMenuItem->getAlign();
|
||||
if (appMenuItem->key() && !appMenuItem->key()->accels().empty()) {
|
||||
int old_align = appMenuItem->align();
|
||||
|
||||
pos = bounds;
|
||||
pos.w -= widget->childSpacing()/4;
|
||||
|
||||
std::string buf = appMenuItem->getKey()->accels().front().toString();
|
||||
std::string buf = appMenuItem->key()->accels().front().toString();
|
||||
|
||||
widget->setAlign(RIGHT | MIDDLE);
|
||||
drawTextString(g, buf.c_str(), fg, ColorNone, widget, pos, 0);
|
||||
@ -1168,24 +1168,24 @@ void SkinTheme::paintMenuItem(ui::PaintEvent& ev)
|
||||
|
||||
void SkinTheme::paintSplitter(PaintEvent& ev)
|
||||
{
|
||||
Graphics* g = ev.getGraphics();
|
||||
Graphics* g = ev.graphics();
|
||||
|
||||
g->fillRect(colors.splitterNormalFace(), g->getClipBounds());
|
||||
}
|
||||
|
||||
void SkinTheme::paintRadioButton(PaintEvent& ev)
|
||||
{
|
||||
Graphics* g = ev.getGraphics();
|
||||
Graphics* g = ev.graphics();
|
||||
ButtonBase* widget = static_cast<ButtonBase*>(ev.getSource());
|
||||
gfx::Rect bounds = widget->getClientBounds();
|
||||
IButtonIcon* iconInterface = widget->getIconInterface();
|
||||
gfx::Rect bounds = widget->clientBounds();
|
||||
IButtonIcon* iconInterface = widget->iconInterface();
|
||||
gfx::Color bg = BGCOLOR;
|
||||
|
||||
gfx::Rect box, text, icon;
|
||||
widget->getTextIconInfo(&box, &text, &icon,
|
||||
iconInterface ? iconInterface->getIconAlign(): 0,
|
||||
iconInterface ? iconInterface->getSize().w: 0,
|
||||
iconInterface ? iconInterface->getSize().h: 0);
|
||||
iconInterface ? iconInterface->iconAlign(): 0,
|
||||
iconInterface ? iconInterface->size().w: 0,
|
||||
iconInterface ? iconInterface->size().h: 0);
|
||||
|
||||
// Background
|
||||
g->fillRect(bg, g->getClipBounds());
|
||||
@ -1212,22 +1212,22 @@ void SkinTheme::paintRadioButton(PaintEvent& ev)
|
||||
|
||||
void SkinTheme::paintSeparator(ui::PaintEvent& ev)
|
||||
{
|
||||
Graphics* g = ev.getGraphics();
|
||||
Graphics* g = ev.graphics();
|
||||
Widget* widget = static_cast<Widget*>(ev.getSource());
|
||||
gfx::Rect bounds = widget->getClientBounds();
|
||||
gfx::Rect bounds = widget->clientBounds();
|
||||
|
||||
// background
|
||||
g->fillRect(BGCOLOR, bounds);
|
||||
|
||||
if (widget->getAlign() & HORIZONTAL) {
|
||||
int h = parts.separatorHorz()->getBitmap(0)->height();
|
||||
if (widget->align() & HORIZONTAL) {
|
||||
int h = parts.separatorHorz()->bitmap(0)->height();
|
||||
drawHline(g, gfx::Rect(bounds.x, bounds.y+bounds.h/2-h/2,
|
||||
bounds.w, h),
|
||||
parts.separatorHorz().get());
|
||||
}
|
||||
|
||||
if (widget->getAlign() & VERTICAL) {
|
||||
int w = parts.separatorVert()->getBitmap(0)->width();
|
||||
if (widget->align() & VERTICAL) {
|
||||
int w = parts.separatorVert()->bitmap(0)->width();
|
||||
drawVline(g, gfx::Rect(bounds.x+bounds.w/2-w/2, bounds.y,
|
||||
w, bounds.h),
|
||||
parts.separatorVert().get());
|
||||
@ -1235,11 +1235,11 @@ void SkinTheme::paintSeparator(ui::PaintEvent& ev)
|
||||
|
||||
// text
|
||||
if (widget->hasText()) {
|
||||
int h = widget->getTextHeight();
|
||||
int h = widget->textHeight();
|
||||
Rect r(
|
||||
bounds.x + widget->border().left()/2 + h/2,
|
||||
bounds.y + bounds.h/2 - h/2,
|
||||
widget->getTextWidth(), h);
|
||||
widget->textWidth(), h);
|
||||
|
||||
drawTextString(g, NULL,
|
||||
colors.separatorLabel(), BGCOLOR,
|
||||
@ -1249,13 +1249,13 @@ void SkinTheme::paintSeparator(ui::PaintEvent& ev)
|
||||
|
||||
void SkinTheme::paintSlider(PaintEvent& ev)
|
||||
{
|
||||
Graphics* g = ev.getGraphics();
|
||||
Graphics* g = ev.graphics();
|
||||
Slider* widget = static_cast<Slider*>(ev.getSource());
|
||||
Rect bounds = widget->getClientBounds();
|
||||
Rect bounds = widget->clientBounds();
|
||||
int min, max, value;
|
||||
|
||||
// Outside borders
|
||||
gfx::Color bgcolor = widget->getBgColor();
|
||||
gfx::Color bgcolor = widget->bgColor();
|
||||
if (!is_transparent(bgcolor))
|
||||
g->fillRect(bgcolor, bounds);
|
||||
|
||||
@ -1268,7 +1268,7 @@ void SkinTheme::paintSlider(PaintEvent& ev)
|
||||
else
|
||||
x = rc.x;
|
||||
|
||||
rc = widget->getClientBounds();
|
||||
rc = widget->clientBounds();
|
||||
|
||||
// The mini-look is used for sliders with tiny borders.
|
||||
bool isMiniLook = false;
|
||||
@ -1289,8 +1289,8 @@ void SkinTheme::paintSlider(PaintEvent& ev)
|
||||
if (bgPainter) {
|
||||
SkinPartPtr nw = parts.miniSliderEmpty();
|
||||
she::Surface* thumb =
|
||||
(widget->hasFocus() ? parts.miniSliderThumbFocused()->getBitmap(0):
|
||||
parts.miniSliderThumb()->getBitmap(0));
|
||||
(widget->hasFocus() ? parts.miniSliderThumbFocused()->bitmap(0):
|
||||
parts.miniSliderThumb()->bitmap(0));
|
||||
|
||||
// Draw background
|
||||
g->fillRect(BGCOLOR, rc);
|
||||
@ -1341,7 +1341,7 @@ void SkinTheme::paintSlider(PaintEvent& ev)
|
||||
colors.sliderEmptyFace());
|
||||
|
||||
// Draw text
|
||||
std::string old_text = widget->getText();
|
||||
std::string old_text = widget->text();
|
||||
widget->setTextQuiet(widget->convertValueToText(value));
|
||||
|
||||
{
|
||||
@ -1368,12 +1368,12 @@ void SkinTheme::paintSlider(PaintEvent& ev)
|
||||
|
||||
void SkinTheme::paintComboBoxEntry(ui::PaintEvent& ev)
|
||||
{
|
||||
Graphics* g = ev.getGraphics();
|
||||
Graphics* g = ev.graphics();
|
||||
Entry* widget = static_cast<Entry*>(ev.getSource());
|
||||
gfx::Rect bounds = widget->getClientBounds();
|
||||
gfx::Rect bounds = widget->clientBounds();
|
||||
bool password = widget->isPassword();
|
||||
int scroll, caret, state, selbeg, selend;
|
||||
const std::string& textString = widget->getText();
|
||||
const std::string& textString = widget->text();
|
||||
int c, ch, x, y, w;
|
||||
int caret_x;
|
||||
|
||||
@ -1391,7 +1391,7 @@ void SkinTheme::paintComboBoxEntry(ui::PaintEvent& ev)
|
||||
|
||||
// Draw the text
|
||||
x = bounds.x + widget->border().left();
|
||||
y = bounds.y + bounds.h/2 - widget->getTextHeight()/2;
|
||||
y = bounds.y + bounds.h/2 - widget->textHeight()/2;
|
||||
|
||||
base::utf8_const_iterator utf8_it = base::utf8_const_iterator(textString.begin());
|
||||
int textlen = base::utf8_length(textString);
|
||||
@ -1445,8 +1445,8 @@ void SkinTheme::paintComboBoxEntry(ui::PaintEvent& ev)
|
||||
void SkinTheme::paintComboBoxButton(PaintEvent& ev)
|
||||
{
|
||||
Button* widget = static_cast<Button*>(ev.getSource());
|
||||
Graphics* g = ev.getGraphics();
|
||||
IButtonIcon* iconInterface = widget->getIconInterface();
|
||||
Graphics* g = ev.graphics();
|
||||
IButtonIcon* iconInterface = widget->iconInterface();
|
||||
SkinPartPtr part_nw;
|
||||
gfx::Color bg;
|
||||
|
||||
@ -1465,7 +1465,7 @@ void SkinTheme::paintComboBoxButton(PaintEvent& ev)
|
||||
part_nw = parts.toolbuttonLast();
|
||||
}
|
||||
|
||||
Rect rc = widget->getClientBounds();
|
||||
Rect rc = widget->clientBounds();
|
||||
|
||||
// external background
|
||||
g->fillRect(BGCOLOR, rc);
|
||||
@ -1476,16 +1476,16 @@ void SkinTheme::paintComboBoxButton(PaintEvent& ev)
|
||||
// Paint the icon
|
||||
if (iconInterface) {
|
||||
// Icon
|
||||
int x = rc.x + rc.w/2 - iconInterface->getSize().w/2;
|
||||
int y = rc.y + rc.h/2 - iconInterface->getSize().h/2;
|
||||
int x = rc.x + rc.w/2 - iconInterface->size().w/2;
|
||||
int y = rc.y + rc.h/2 - iconInterface->size().h/2;
|
||||
|
||||
paintIcon(widget, ev.getGraphics(), iconInterface, x, y);
|
||||
paintIcon(widget, ev.graphics(), iconInterface, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
void SkinTheme::paintTextBox(ui::PaintEvent& ev)
|
||||
{
|
||||
Graphics* g = ev.getGraphics();
|
||||
Graphics* g = ev.graphics();
|
||||
Widget* widget = static_cast<Widget*>(ev.getSource());
|
||||
|
||||
drawTextBox(g, widget, NULL, NULL,
|
||||
@ -1495,9 +1495,9 @@ void SkinTheme::paintTextBox(ui::PaintEvent& ev)
|
||||
|
||||
void SkinTheme::paintView(PaintEvent& ev)
|
||||
{
|
||||
Graphics* g = ev.getGraphics();
|
||||
Graphics* g = ev.graphics();
|
||||
View* widget = static_cast<View*>(ev.getSource());
|
||||
gfx::Rect bounds = widget->getClientBounds();
|
||||
gfx::Rect bounds = widget->clientBounds();
|
||||
gfx::Color bg = BGCOLOR;
|
||||
Style* style = styles.view();
|
||||
|
||||
@ -1517,7 +1517,7 @@ void SkinTheme::paintView(PaintEvent& ev)
|
||||
void SkinTheme::paintViewScrollbar(PaintEvent& ev)
|
||||
{
|
||||
ScrollBar* widget = static_cast<ScrollBar*>(ev.getSource());
|
||||
Graphics* g = ev.getGraphics();
|
||||
Graphics* g = ev.graphics();
|
||||
int pos, len;
|
||||
|
||||
bool isMiniLook = false;
|
||||
@ -1546,11 +1546,11 @@ void SkinTheme::paintViewScrollbar(PaintEvent& ev)
|
||||
Style::State state;
|
||||
if (widget->hasMouse()) state += Style::hover();
|
||||
|
||||
gfx::Rect rc = widget->getClientBounds();
|
||||
gfx::Rect rc = widget->clientBounds();
|
||||
bgStyle->paint(g, rc, NULL, state);
|
||||
|
||||
// Horizontal bar
|
||||
if (widget->getAlign() & HORIZONTAL) {
|
||||
if (widget->align() & HORIZONTAL) {
|
||||
rc.x += pos;
|
||||
rc.w = len;
|
||||
}
|
||||
@ -1566,19 +1566,19 @@ void SkinTheme::paintViewScrollbar(PaintEvent& ev)
|
||||
void SkinTheme::paintViewViewport(PaintEvent& ev)
|
||||
{
|
||||
Viewport* widget = static_cast<Viewport*>(ev.getSource());
|
||||
Graphics* g = ev.getGraphics();
|
||||
Graphics* g = ev.graphics();
|
||||
gfx::Color bg = BGCOLOR;
|
||||
|
||||
if (!is_transparent(bg))
|
||||
g->fillRect(bg, widget->getClientBounds());
|
||||
g->fillRect(bg, widget->clientBounds());
|
||||
}
|
||||
|
||||
void SkinTheme::paintWindow(PaintEvent& ev)
|
||||
{
|
||||
Graphics* g = ev.getGraphics();
|
||||
Graphics* g = ev.graphics();
|
||||
Window* window = static_cast<Window*>(ev.getSource());
|
||||
Rect pos = window->getClientBounds();
|
||||
Rect cpos = window->getClientChildrenBounds();
|
||||
Rect pos = window->clientBounds();
|
||||
Rect cpos = window->clientChildrenBounds();
|
||||
|
||||
if (!window->isDesktop()) {
|
||||
// window frame
|
||||
@ -1586,8 +1586,8 @@ void SkinTheme::paintWindow(PaintEvent& ev)
|
||||
styles.window()->paint(g, pos, NULL, Style::State());
|
||||
styles.windowTitle()->paint(g,
|
||||
gfx::Rect(cpos.x, pos.y+5*guiscale(), cpos.w, // TODO this hard-coded 5 should be configurable in skin.xml
|
||||
window->getTextHeight()),
|
||||
window->getText().c_str(), Style::State());
|
||||
window->textHeight()),
|
||||
window->text().c_str(), Style::State());
|
||||
}
|
||||
// menubox
|
||||
else {
|
||||
@ -1604,25 +1604,25 @@ void SkinTheme::paintPopupWindow(PaintEvent& ev)
|
||||
{
|
||||
Widget* widget = static_cast<Widget*>(ev.getSource());
|
||||
Window* window = static_cast<Window*>(ev.getSource());
|
||||
Graphics* g = ev.getGraphics();
|
||||
gfx::Rect pos = window->getClientBounds();
|
||||
Graphics* g = ev.graphics();
|
||||
gfx::Rect pos = window->clientBounds();
|
||||
|
||||
if (!is_transparent(BGCOLOR))
|
||||
styles.menubox()->paint(g, pos, NULL, Style::State());
|
||||
|
||||
pos.shrink(window->border());
|
||||
|
||||
g->drawAlignedUIString(window->getText(),
|
||||
g->drawAlignedUIString(window->text(),
|
||||
colors.text(),
|
||||
window->getBgColor(), pos,
|
||||
window->getAlign());
|
||||
window->bgColor(), pos,
|
||||
window->align());
|
||||
}
|
||||
|
||||
void SkinTheme::paintWindowButton(ui::PaintEvent& ev)
|
||||
{
|
||||
ButtonBase* widget = static_cast<ButtonBase*>(ev.getSource());
|
||||
Graphics* g = ev.getGraphics();
|
||||
Rect rc = widget->getClientBounds();
|
||||
Graphics* g = ev.graphics();
|
||||
Rect rc = widget->clientBounds();
|
||||
SkinPartPtr part;
|
||||
|
||||
if (widget->isSelected())
|
||||
@ -1632,33 +1632,33 @@ void SkinTheme::paintWindowButton(ui::PaintEvent& ev)
|
||||
else
|
||||
part = parts.windowCloseButtonNormal();
|
||||
|
||||
g->drawRgbaSurface(part->getBitmap(0), rc.x, rc.y);
|
||||
g->drawRgbaSurface(part->bitmap(0), rc.x, rc.y);
|
||||
}
|
||||
|
||||
void SkinTheme::paintTooltip(PaintEvent& ev)
|
||||
{
|
||||
ui::TipWindow* widget = static_cast<ui::TipWindow*>(ev.getSource());
|
||||
Graphics* g = ev.getGraphics();
|
||||
Rect absRc = widget->getBounds();
|
||||
Rect rc = widget->getClientBounds();
|
||||
Graphics* g = ev.graphics();
|
||||
Rect absRc = widget->bounds();
|
||||
Rect rc = widget->clientBounds();
|
||||
gfx::Color fg = colors.tooltipText();
|
||||
gfx::Color bg = colors.tooltipFace();
|
||||
SkinPartPtr tooltipPart = parts.tooltip();
|
||||
|
||||
she::Surface* nw = tooltipPart->getBitmapNW();
|
||||
she::Surface* n = tooltipPart->getBitmapN();
|
||||
she::Surface* ne = tooltipPart->getBitmapNE();
|
||||
she::Surface* e = tooltipPart->getBitmapE();
|
||||
she::Surface* se = tooltipPart->getBitmapSE();
|
||||
she::Surface* s = tooltipPart->getBitmapS();
|
||||
she::Surface* sw = tooltipPart->getBitmapSW();
|
||||
she::Surface* w = tooltipPart->getBitmapW();
|
||||
she::Surface* nw = tooltipPart->bitmapNW();
|
||||
she::Surface* n = tooltipPart->bitmapN();
|
||||
she::Surface* ne = tooltipPart->bitmapNE();
|
||||
she::Surface* e = tooltipPart->bitmapE();
|
||||
she::Surface* se = tooltipPart->bitmapSE();
|
||||
she::Surface* s = tooltipPart->bitmapS();
|
||||
she::Surface* sw = tooltipPart->bitmapSW();
|
||||
she::Surface* w = tooltipPart->bitmapW();
|
||||
|
||||
switch (widget->getArrowAlign()) {
|
||||
case TOP | LEFT: nw = parts.tooltipArrow()->getBitmapNW(); break;
|
||||
case TOP | RIGHT: ne = parts.tooltipArrow()->getBitmapNE(); break;
|
||||
case BOTTOM | LEFT: sw = parts.tooltipArrow()->getBitmapSW(); break;
|
||||
case BOTTOM | RIGHT: se = parts.tooltipArrow()->getBitmapSE(); break;
|
||||
case TOP | LEFT: nw = parts.tooltipArrow()->bitmapNW(); break;
|
||||
case TOP | RIGHT: ne = parts.tooltipArrow()->bitmapNE(); break;
|
||||
case BOTTOM | LEFT: sw = parts.tooltipArrow()->bitmapSW(); break;
|
||||
case BOTTOM | RIGHT: se = parts.tooltipArrow()->bitmapSE(); break;
|
||||
}
|
||||
|
||||
drawRect(g, rc, nw, n, ne, e, se, s, sw, w);
|
||||
@ -1667,29 +1667,29 @@ void SkinTheme::paintTooltip(PaintEvent& ev)
|
||||
she::Surface* arrow = NULL;
|
||||
gfx::Rect target(widget->target());
|
||||
target = target.createIntersection(gfx::Rect(0, 0, ui::display_w(), ui::display_h()));
|
||||
target.offset(-absRc.getOrigin());
|
||||
target.offset(-absRc.origin());
|
||||
|
||||
switch (widget->getArrowAlign()) {
|
||||
case TOP:
|
||||
arrow = parts.tooltipArrow()->getBitmapN();
|
||||
arrow = parts.tooltipArrow()->bitmapN();
|
||||
g->drawRgbaSurface(arrow,
|
||||
target.x+target.w/2-arrow->width()/2,
|
||||
rc.y);
|
||||
break;
|
||||
case BOTTOM:
|
||||
arrow = parts.tooltipArrow()->getBitmapS();
|
||||
arrow = parts.tooltipArrow()->bitmapS();
|
||||
g->drawRgbaSurface(arrow,
|
||||
target.x+target.w/2-arrow->width()/2,
|
||||
rc.y+rc.h-arrow->height());
|
||||
break;
|
||||
case LEFT:
|
||||
arrow = parts.tooltipArrow()->getBitmapW();
|
||||
arrow = parts.tooltipArrow()->bitmapW();
|
||||
g->drawRgbaSurface(arrow,
|
||||
rc.x,
|
||||
target.y+target.h/2-arrow->height()/2);
|
||||
break;
|
||||
case RIGHT:
|
||||
arrow = parts.tooltipArrow()->getBitmapE();
|
||||
arrow = parts.tooltipArrow()->bitmapE();
|
||||
g->drawRgbaSurface(arrow,
|
||||
rc.x+rc.w-arrow->width(),
|
||||
target.y+target.h/2-arrow->height()/2);
|
||||
@ -1707,12 +1707,12 @@ void SkinTheme::paintTooltip(PaintEvent& ev)
|
||||
|
||||
rc.shrink(widget->border());
|
||||
|
||||
g->drawAlignedUIString(widget->getText(), fg, bg, rc, widget->getAlign());
|
||||
g->drawAlignedUIString(widget->text(), fg, bg, rc, widget->align());
|
||||
}
|
||||
|
||||
gfx::Color SkinTheme::getWidgetBgColor(Widget* widget)
|
||||
{
|
||||
gfx::Color c = widget->getBgColor();
|
||||
gfx::Color c = widget->bgColor();
|
||||
bool decorative = widget->isDecorative();
|
||||
|
||||
if (!is_transparent(c) || widget->type() == kWindowWidget)
|
||||
@ -1730,28 +1730,28 @@ void SkinTheme::drawTextString(Graphics* g, const char *t, gfx::Color fg_color,
|
||||
if (t || widget->hasText()) {
|
||||
Rect textrc;
|
||||
|
||||
g->setFont(widget->getFont());
|
||||
g->setFont(widget->font());
|
||||
|
||||
if (!t)
|
||||
t = widget->getText().c_str();
|
||||
t = widget->text().c_str();
|
||||
|
||||
textrc.setSize(g->measureUIString(t));
|
||||
|
||||
// Horizontally text alignment
|
||||
|
||||
if (widget->getAlign() & RIGHT)
|
||||
if (widget->align() & RIGHT)
|
||||
textrc.x = rc.x + rc.w - textrc.w - 1;
|
||||
else if (widget->getAlign() & CENTER)
|
||||
textrc.x = rc.getCenter().x - textrc.w/2;
|
||||
else if (widget->align() & CENTER)
|
||||
textrc.x = rc.center().x - textrc.w/2;
|
||||
else
|
||||
textrc.x = rc.x;
|
||||
|
||||
// Vertically text alignment
|
||||
|
||||
if (widget->getAlign() & BOTTOM)
|
||||
if (widget->align() & BOTTOM)
|
||||
textrc.y = rc.y + rc.h - textrc.h - 1;
|
||||
else if (widget->getAlign() & MIDDLE)
|
||||
textrc.y = rc.getCenter().y - textrc.h/2;
|
||||
else if (widget->align() & MIDDLE)
|
||||
textrc.y = rc.center().y - textrc.h/2;
|
||||
else
|
||||
textrc.y = rc.y;
|
||||
|
||||
@ -1771,8 +1771,8 @@ void SkinTheme::drawTextString(Graphics* g, const char *t, gfx::Color fg_color,
|
||||
// Text
|
||||
Rect textWrap = textrc.createIntersection(
|
||||
// TODO add ui::Widget::getPadding() property
|
||||
// Rect(widget->getClientBounds()).shrink(widget->border()));
|
||||
widget->getClientBounds()).inflate(0, 1*guiscale());
|
||||
// Rect(widget->clientBounds()).shrink(widget->border()));
|
||||
widget->clientBounds()).inflate(0, 1*guiscale());
|
||||
|
||||
IntersectClip clip(g, textWrap);
|
||||
if (clip) {
|
||||
@ -1781,7 +1781,7 @@ void SkinTheme::drawTextString(Graphics* g, const char *t, gfx::Color fg_color,
|
||||
g->drawUIString(t,
|
||||
colors.background(),
|
||||
gfx::ColorNone,
|
||||
textrc.getOrigin() + Point(guiscale(), guiscale()));
|
||||
textrc.origin() + Point(guiscale(), guiscale()));
|
||||
}
|
||||
|
||||
g->drawUIString(t,
|
||||
@ -1789,7 +1789,7 @@ void SkinTheme::drawTextString(Graphics* g, const char *t, gfx::Color fg_color,
|
||||
colors.disabled():
|
||||
(gfx::geta(fg_color) > 0 ? fg_color :
|
||||
colors.text())),
|
||||
bg_color, textrc.getOrigin());
|
||||
bg_color, textrc.origin());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1797,7 +1797,7 @@ void SkinTheme::drawTextString(Graphics* g, const char *t, gfx::Color fg_color,
|
||||
void SkinTheme::drawEntryCaret(ui::Graphics* g, Entry* widget, int x, int y)
|
||||
{
|
||||
gfx::Color color = colors.text();
|
||||
int h = widget->getTextHeight();
|
||||
int h = widget->textHeight();
|
||||
|
||||
for (int u=x; u<x+2*guiscale(); ++u)
|
||||
g->drawVLine(color, u, y-1, h+2);
|
||||
@ -1876,23 +1876,23 @@ void SkinTheme::drawRect(Graphics* g, const Rect& rc,
|
||||
void SkinTheme::drawRect(ui::Graphics* g, const gfx::Rect& rc, SkinPart* skinPart, gfx::Color bg)
|
||||
{
|
||||
drawRect(g, rc,
|
||||
skinPart->getBitmap(0),
|
||||
skinPart->getBitmap(1),
|
||||
skinPart->getBitmap(2),
|
||||
skinPart->getBitmap(3),
|
||||
skinPart->getBitmap(4),
|
||||
skinPart->getBitmap(5),
|
||||
skinPart->getBitmap(6),
|
||||
skinPart->getBitmap(7));
|
||||
skinPart->bitmap(0),
|
||||
skinPart->bitmap(1),
|
||||
skinPart->bitmap(2),
|
||||
skinPart->bitmap(3),
|
||||
skinPart->bitmap(4),
|
||||
skinPart->bitmap(5),
|
||||
skinPart->bitmap(6),
|
||||
skinPart->bitmap(7));
|
||||
|
||||
// Center
|
||||
if (!is_transparent(bg)) {
|
||||
gfx::Rect inside = rc;
|
||||
inside.shrink(Border(
|
||||
skinPart->getBitmap(7)->width(),
|
||||
skinPart->getBitmap(1)->height(),
|
||||
skinPart->getBitmap(3)->width(),
|
||||
skinPart->getBitmap(5)->height()));
|
||||
skinPart->bitmap(7)->width(),
|
||||
skinPart->bitmap(1)->height(),
|
||||
skinPart->bitmap(3)->width(),
|
||||
skinPart->bitmap(5)->height()));
|
||||
|
||||
IntersectClip clip(g, inside);
|
||||
if (clip)
|
||||
@ -1924,16 +1924,16 @@ void SkinTheme::drawHline(ui::Graphics* g, const gfx::Rect& rc, SkinPart* part)
|
||||
int x;
|
||||
|
||||
for (x = rc.x;
|
||||
x < rc.x2()-part->getSize().w;
|
||||
x += part->getSize().w) {
|
||||
g->drawRgbaSurface(part->getBitmap(0), x, rc.y);
|
||||
x < rc.x2()-part->size().w;
|
||||
x += part->size().w) {
|
||||
g->drawRgbaSurface(part->bitmap(0), x, rc.y);
|
||||
}
|
||||
|
||||
if (x < rc.x2()) {
|
||||
Rect rc2(x, rc.y, rc.w-(x-rc.x), part->getSize().h);
|
||||
Rect rc2(x, rc.y, rc.w-(x-rc.x), part->size().h);
|
||||
IntersectClip clip(g, rc2);
|
||||
if (clip)
|
||||
g->drawRgbaSurface(part->getBitmap(0), x, rc.y);
|
||||
g->drawRgbaSurface(part->bitmap(0), x, rc.y);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1942,16 +1942,16 @@ void SkinTheme::drawVline(ui::Graphics* g, const gfx::Rect& rc, SkinPart* part)
|
||||
int y;
|
||||
|
||||
for (y = rc.y;
|
||||
y < rc.y2()-part->getSize().h;
|
||||
y += part->getSize().h) {
|
||||
g->drawRgbaSurface(part->getBitmap(0), rc.x, y);
|
||||
y < rc.y2()-part->size().h;
|
||||
y += part->size().h) {
|
||||
g->drawRgbaSurface(part->bitmap(0), rc.x, y);
|
||||
}
|
||||
|
||||
if (y < rc.y2()) {
|
||||
Rect rc2(rc.x, y, part->getSize().w, rc.h-(y-rc.y));
|
||||
Rect rc2(rc.x, y, part->size().w, rc.h-(y-rc.y));
|
||||
IntersectClip clip(g, rc2);
|
||||
if (clip)
|
||||
g->drawRgbaSurface(part->getBitmap(0), rc.x, y);
|
||||
g->drawRgbaSurface(part->bitmap(0), rc.x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1979,13 +1979,13 @@ void SkinTheme::paintIcon(Widget* widget, Graphics* g, IButtonIcon* iconInterfac
|
||||
// enabled
|
||||
if (widget->isEnabled()) {
|
||||
if (widget->isSelected()) // selected
|
||||
icon_bmp = iconInterface->getSelectedIcon();
|
||||
icon_bmp = iconInterface->selectedIcon();
|
||||
else
|
||||
icon_bmp = iconInterface->getNormalIcon();
|
||||
icon_bmp = iconInterface->normalIcon();
|
||||
}
|
||||
// disabled
|
||||
else {
|
||||
icon_bmp = iconInterface->getDisabledIcon();
|
||||
icon_bmp = iconInterface->disabledIcon();
|
||||
}
|
||||
|
||||
if (icon_bmp)
|
||||
|
@ -147,11 +147,11 @@ namespace app {
|
||||
};
|
||||
|
||||
inline SkinPartPtr get_part_by_id(const std::string& id) {
|
||||
return static_cast<SkinTheme*>(ui::Manager::getDefault()->getTheme())->getPartById(id);
|
||||
return static_cast<SkinTheme*>(ui::Manager::getDefault()->theme())->getPartById(id);
|
||||
}
|
||||
|
||||
inline gfx::Color get_color_by_id(const std::string& id) {
|
||||
return static_cast<SkinTheme*>(ui::Manager::getDefault()->getTheme())->getColorById(id);
|
||||
return static_cast<SkinTheme*>(ui::Manager::getDefault()->theme())->getColorById(id);
|
||||
}
|
||||
|
||||
} // namespace skin
|
||||
|
@ -44,7 +44,7 @@ void BackgroundRule::onPaint(ui::Graphics* g, const gfx::Rect& bounds, const cha
|
||||
if (!gfx::is_transparent(m_color))
|
||||
g->fillRect(m_color, bounds);
|
||||
|
||||
she::Surface* bmp = m_part->getBitmap(0);
|
||||
she::Surface* bmp = m_part->bitmap(0);
|
||||
|
||||
if (m_repeat == BackgroundRepeat::NO_REPEAT) {
|
||||
g->drawRgbaSurface(bmp, bounds.x, bounds.y);
|
||||
@ -90,7 +90,7 @@ void TextRule::onPaint(ui::Graphics* g, const gfx::Rect& bounds, const char* tex
|
||||
|
||||
void IconRule::onPaint(ui::Graphics* g, const gfx::Rect& bounds, const char* text)
|
||||
{
|
||||
she::Surface* bmp = m_part->getBitmap(0);
|
||||
she::Surface* bmp = m_part->bitmap(0);
|
||||
int x, y;
|
||||
|
||||
if (m_align & ui::RIGHT)
|
||||
@ -190,8 +190,8 @@ gfx::Size Rules::sizeHint(const char* text, int maxWidth)
|
||||
{
|
||||
gfx::Size sz(0, 0);
|
||||
if (m_icon) {
|
||||
sz.w += m_icon->getPart()->getBitmap(0)->width();
|
||||
sz.h = m_icon->getPart()->getBitmap(0)->height();
|
||||
sz.w += m_icon->getPart()->bitmap(0)->width();
|
||||
sz.h = m_icon->getPart()->bitmap(0)->height();
|
||||
}
|
||||
if (m_text && text) {
|
||||
ui::ScreenGraphics g;
|
||||
|
@ -144,9 +144,9 @@ public:
|
||||
scancode == kKeyEnterPad)) {
|
||||
Command* cmd = CommandsModule::instance()->getCommandByName(CommandId::GotoFrame);
|
||||
Params params;
|
||||
int frame = getTextInt();
|
||||
int frame = textInt();
|
||||
if (frame > 0) {
|
||||
params.set("frame", getText().c_str());
|
||||
params.set("frame", text().c_str());
|
||||
UIContext::instance()->executeCommand(cmd, params);
|
||||
}
|
||||
// Select the text again
|
||||
@ -177,7 +177,7 @@ StatusBar::StatusBar()
|
||||
|
||||
setDoubleBuffered(true);
|
||||
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->getTheme());
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
setBgColor(theme->colors.statusBarFace());
|
||||
|
||||
this->setFocusStop(true);
|
||||
@ -308,8 +308,8 @@ void StatusBar::showTip(int msecs, const char *format, ...)
|
||||
m_tipwindow->openWindow();
|
||||
m_tipwindow->remapWindow();
|
||||
|
||||
x = getBounds().x2() - m_tipwindow->getBounds().w;
|
||||
y = getBounds().y - m_tipwindow->getBounds().h;
|
||||
x = bounds().x2() - m_tipwindow->bounds().w;
|
||||
y = bounds().y - m_tipwindow->bounds().h;
|
||||
m_tipwindow->positionWindow(x, y);
|
||||
|
||||
m_tipwindow->startTimer();
|
||||
@ -365,12 +365,12 @@ void StatusBar::showSnapToGridWarning(bool state)
|
||||
m_snapToGridWindow->openWindow();
|
||||
m_snapToGridWindow->remapWindow();
|
||||
|
||||
Rect rc = getBounds();
|
||||
Rect rc = bounds();
|
||||
int toolBarWidth = ToolBar::instance()->sizeHint().w;
|
||||
|
||||
m_snapToGridWindow->positionWindow(
|
||||
rc.x+rc.w-toolBarWidth-m_snapToGridWindow->getBounds().w,
|
||||
rc.y-m_snapToGridWindow->getBounds().h);
|
||||
rc.x+rc.w-toolBarWidth-m_snapToGridWindow->bounds().w,
|
||||
rc.y-m_snapToGridWindow->bounds().h);
|
||||
}
|
||||
|
||||
m_snapToGridWindow->setDocument(
|
||||
@ -387,10 +387,10 @@ void StatusBar::showSnapToGridWarning(bool state)
|
||||
|
||||
void StatusBar::onResize(ResizeEvent& ev)
|
||||
{
|
||||
setBoundsQuietly(ev.getBounds());
|
||||
setBoundsQuietly(ev.bounds());
|
||||
|
||||
Border border = this->border();
|
||||
Rect rc = ev.getBounds();
|
||||
Rect rc = ev.bounds();
|
||||
bool docControls = (rc.w > 300*ui::guiscale());
|
||||
if (docControls) {
|
||||
int prefWidth = m_docControls->sizeHint().w;
|
||||
@ -408,18 +408,18 @@ void StatusBar::onResize(ResizeEvent& ev)
|
||||
|
||||
void StatusBar::onSizeHint(SizeHintEvent& ev)
|
||||
{
|
||||
int s = 4*guiscale() + getTextHeight() + 4*guiscale();
|
||||
int s = 4*guiscale() + textHeight() + 4*guiscale();
|
||||
ev.setSizeHint(Size(s, s));
|
||||
}
|
||||
|
||||
void StatusBar::onPaint(ui::PaintEvent& ev)
|
||||
{
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->getTheme());
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
gfx::Color textColor = theme->colors.statusBarText();
|
||||
Rect rc = getClientBounds();
|
||||
Graphics* g = ev.getGraphics();
|
||||
Rect rc = clientBounds();
|
||||
Graphics* g = ev.graphics();
|
||||
|
||||
g->fillRect(getBgColor(), rc);
|
||||
g->fillRect(bgColor(), rc);
|
||||
|
||||
rc.shrink(Border(2, 1, 2, 2)*guiscale());
|
||||
|
||||
@ -450,9 +450,9 @@ void StatusBar::onPaint(ui::PaintEvent& ev)
|
||||
}
|
||||
|
||||
g->drawString(str, textColor, ColorNone,
|
||||
gfx::Point(x, rc.y + rc.h/2 - getFont()->height()/2));
|
||||
gfx::Point(x, rc.y + rc.h/2 - font()->height()/2));
|
||||
|
||||
x += getFont()->textLength(str.c_str()) + 4*guiscale();
|
||||
x += font()->textLength(str.c_str()) + 4*guiscale();
|
||||
}
|
||||
|
||||
// Show tool
|
||||
@ -466,11 +466,11 @@ void StatusBar::onPaint(ui::PaintEvent& ev)
|
||||
}
|
||||
|
||||
// Status bar text
|
||||
if (getTextLength() > 0) {
|
||||
g->drawString(getText(), textColor, ColorNone,
|
||||
gfx::Point(x, rc.y + rc.h/2 - getFont()->height()/2));
|
||||
if (textLength() > 0) {
|
||||
g->drawString(text(), textColor, ColorNone,
|
||||
gfx::Point(x, rc.y + rc.h/2 - font()->height()/2));
|
||||
|
||||
x += getFont()->textLength(getText().c_str()) + 4*guiscale();
|
||||
x += font()->textLength(text().c_str()) + 4*guiscale();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,11 +46,11 @@ void StyledButton::onSizeHint(SizeHintEvent& ev) {
|
||||
}
|
||||
|
||||
void StyledButton::onPaint(PaintEvent& ev) {
|
||||
Graphics* g = ev.getGraphics();
|
||||
Graphics* g = ev.graphics();
|
||||
skin::Style::State state;
|
||||
if (hasMouse()) state += skin::Style::hover();
|
||||
if (isSelected()) state += skin::Style::clicked();
|
||||
m_style->paint(g, getClientBounds(), NULL, state);
|
||||
m_style->paint(g, clientBounds(), NULL, state);
|
||||
}
|
||||
|
||||
} // namespace app
|
||||
|
@ -30,7 +30,7 @@
|
||||
#define ANI_REMOVING_TAB_TICKS 10
|
||||
#define ANI_REORDER_TABS_TICKS 5
|
||||
|
||||
#define HAS_ARROWS(tabs) ((m_button_left->getParent() == (tabs)))
|
||||
#define HAS_ARROWS(tabs) ((m_button_left->parent() == (tabs)))
|
||||
|
||||
namespace app {
|
||||
|
||||
@ -66,7 +66,7 @@ Tabs::Tabs(TabsDelegate* delegate)
|
||||
setDoubleBuffered(true);
|
||||
initTheme();
|
||||
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
m_tabsHeight = theme->dimensions.tabsHeight();
|
||||
m_tabsBottomHeight = theme->dimensions.tabsBottomHeight();
|
||||
setBgColor(theme->colors.windowFace());
|
||||
@ -149,8 +149,8 @@ void Tabs::removeTab(TabView* tabView, bool with_animation)
|
||||
|
||||
void Tabs::updateTabs()
|
||||
{
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->getTheme());
|
||||
double availWidth = getBounds().w - m_border*ui::guiscale();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
double availWidth = bounds().w - m_border*ui::guiscale();
|
||||
double defTabWidth = theme->dimensions.tabsWidth();
|
||||
double tabWidth = defTabWidth;
|
||||
if (tabWidth * m_list.size() > availWidth) {
|
||||
@ -250,7 +250,7 @@ TabView* Tabs::getSelectedTab()
|
||||
|
||||
void Tabs::setDockedStyle()
|
||||
{
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->getTheme());
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
|
||||
m_docked = true;
|
||||
m_tabsHeight = theme->dimensions.dockedTabsHeight();
|
||||
@ -264,7 +264,7 @@ void Tabs::setDropViewPreview(const gfx::Point& pos, TabView* view)
|
||||
int newIndex = -1;
|
||||
|
||||
if (!m_list.empty()) {
|
||||
newIndex = (pos.x - getBounds().x) / m_list[0]->width;
|
||||
newIndex = (pos.x - bounds().x) / m_list[0]->width;
|
||||
newIndex = MID(0, newIndex, (int)m_list.size());
|
||||
}
|
||||
else
|
||||
@ -274,7 +274,7 @@ void Tabs::setDropViewPreview(const gfx::Point& pos, TabView* view)
|
||||
m_dropNewTab != view);
|
||||
|
||||
m_dropNewIndex = newIndex;
|
||||
m_dropNewPosX = (pos.x - getBounds().x);
|
||||
m_dropNewPosX = (pos.x - bounds().x);
|
||||
m_dropNewTab = view;
|
||||
|
||||
if (startAni)
|
||||
@ -316,10 +316,10 @@ bool Tabs::onProcessMessage(Message* msg)
|
||||
// We are dragging a tab...
|
||||
else {
|
||||
// Floating tab (to create a new window)
|
||||
if (!getBounds().contains(mousePos) &&
|
||||
if (!bounds().contains(mousePos) &&
|
||||
(ABS(delta.y) > 16*guiscale() ||
|
||||
mousePos.x < getBounds().x-16*guiscale() ||
|
||||
mousePos.x > getBounds().x2()+16*guiscale())) {
|
||||
mousePos.x < bounds().x-16*guiscale() ||
|
||||
mousePos.x > bounds().x2()+16*guiscale())) {
|
||||
DropViewPreviewResult result = DropViewPreviewResult::FLOATING;
|
||||
|
||||
if (!m_floatingTab) {
|
||||
@ -370,7 +370,7 @@ bool Tabs::onProcessMessage(Message* msg)
|
||||
MouseMessage* mouseMsg = static_cast<MouseMessage*>(msg);
|
||||
m_dragMousePos = mouseMsg->position();
|
||||
m_floatingOffset = mouseMsg->position() -
|
||||
(getBounds().getOrigin() + getTabBounds(m_hot.get()).getOrigin());
|
||||
(bounds().origin() + getTabBounds(m_hot.get()).origin());
|
||||
|
||||
if (m_hotCloseButton) {
|
||||
if (!m_clickedCloseButton) {
|
||||
@ -468,12 +468,12 @@ bool Tabs::onProcessMessage(Message* msg)
|
||||
|
||||
void Tabs::onPaint(PaintEvent& ev)
|
||||
{
|
||||
Graphics* g = ev.getGraphics();
|
||||
gfx::Rect rect = getClientBounds();
|
||||
Graphics* g = ev.graphics();
|
||||
gfx::Rect rect = clientBounds();
|
||||
gfx::Rect box(rect.x, rect.y, rect.w,
|
||||
m_tabsHeight - m_tabsBottomHeight);
|
||||
|
||||
g->fillRect(getBgColor(), g->getClipBounds());
|
||||
g->fillRect(bgColor(), g->getClipBounds());
|
||||
|
||||
if (!m_docked)
|
||||
drawFiller(g, box);
|
||||
@ -522,7 +522,7 @@ void Tabs::onPaint(PaintEvent& ev)
|
||||
|
||||
// New tab from other Tab that want to be dropped here.
|
||||
if (m_dropNewTab) {
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->getTheme());
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
Tab newTab(m_dropNewTab);
|
||||
|
||||
newTab.width = newTab.oldWidth =
|
||||
@ -539,7 +539,7 @@ void Tabs::onPaint(PaintEvent& ev)
|
||||
|
||||
void Tabs::onResize(ResizeEvent& ev)
|
||||
{
|
||||
setBoundsQuietly(ev.getBounds());
|
||||
setBoundsQuietly(ev.bounds());
|
||||
updateTabs();
|
||||
}
|
||||
|
||||
@ -567,7 +567,7 @@ void Tabs::drawTab(Graphics* g, const gfx::Rect& _box,
|
||||
if (box.w < ui::guiscale()*8)
|
||||
box.w = ui::guiscale()*8;
|
||||
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->getTheme());
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
int clipTextRightSide;
|
||||
|
||||
gfx::Rect closeBox = getTabCloseButtonBounds(tab, box);
|
||||
@ -621,7 +621,7 @@ void Tabs::drawTab(Graphics* g, const gfx::Rect& _box,
|
||||
// Tab bottom part
|
||||
if (!m_docked)
|
||||
theme->styles.tabBottom()->paint(g,
|
||||
gfx::Rect(box.x, box.y2(), box.w, getBounds().y2()-box.y2()),
|
||||
gfx::Rect(box.x, box.y2(), box.w, bounds().y2()-box.y2()),
|
||||
nullptr, state);
|
||||
|
||||
// Close button
|
||||
@ -655,8 +655,8 @@ void Tabs::drawTab(Graphics* g, const gfx::Rect& _box,
|
||||
|
||||
void Tabs::drawFiller(ui::Graphics* g, const gfx::Rect& box)
|
||||
{
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->getTheme());
|
||||
gfx::Rect rect = getClientBounds();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
gfx::Rect rect = clientBounds();
|
||||
skin::Style::State state;
|
||||
|
||||
theme->styles.tabFiller()->paint(g,
|
||||
@ -697,7 +697,7 @@ void Tabs::calculateHot()
|
||||
if (m_isDragging)
|
||||
return;
|
||||
|
||||
gfx::Rect rect = getBounds();
|
||||
gfx::Rect rect = bounds();
|
||||
gfx::Rect box(rect.x+m_border*guiscale(), rect.y, 0, rect.h-1);
|
||||
gfx::Point mousePos = ui::get_mouse_position();
|
||||
TabPtr hot(nullptr);
|
||||
@ -733,7 +733,7 @@ void Tabs::calculateHot()
|
||||
|
||||
gfx::Rect Tabs::getTabCloseButtonBounds(Tab* tab, const gfx::Rect& box)
|
||||
{
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->getTheme());
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
int iconW = theme->dimensions.tabsCloseIconWidth();
|
||||
int iconH = theme->dimensions.tabsCloseIconHeight();
|
||||
|
||||
@ -778,7 +778,7 @@ void Tabs::onAnimationFrame()
|
||||
void Tabs::onAnimationStop(int animation)
|
||||
{
|
||||
if (m_list.empty()) {
|
||||
Widget* root = getRoot();
|
||||
Widget* root = window();
|
||||
if (root)
|
||||
root->layout();
|
||||
}
|
||||
@ -873,7 +873,7 @@ void Tabs::stopDrag(DropTabResult result)
|
||||
|
||||
gfx::Rect Tabs::getTabBounds(Tab* tab)
|
||||
{
|
||||
gfx::Rect rect = getClientBounds();
|
||||
gfx::Rect rect = clientBounds();
|
||||
gfx::Rect box(rect.x, rect.y, rect.w, m_tabsHeight - m_tabsBottomHeight);
|
||||
int startX = m_border*guiscale();
|
||||
double t = animationTime();
|
||||
@ -927,7 +927,7 @@ void Tabs::createFloatingOverlay(Tab* tab)
|
||||
}
|
||||
{
|
||||
Graphics g(surface, 0, 0);
|
||||
g.setFont(getFont());
|
||||
g.setFont(font());
|
||||
drawTab(&g, g.getClipBounds(), tab, 0, true, true);
|
||||
}
|
||||
#ifdef USE_ALLEG4_BACKEND
|
||||
@ -987,7 +987,7 @@ void Tabs::updateMouseCursor()
|
||||
void Tabs::updateDragTabIndexes(int mouseX, bool startAni)
|
||||
{
|
||||
if (m_dragTab) {
|
||||
int i = (mouseX - m_border*guiscale() - getBounds().x) / m_dragTab->width;
|
||||
int i = (mouseX - m_border*guiscale() - bounds().x) / m_dragTab->width;
|
||||
|
||||
if (m_dragCopy) {
|
||||
i = MID(0, i, int(m_list.size()));
|
||||
|
@ -205,7 +205,7 @@ void Timeline::updateUsingEditor(Editor* editor)
|
||||
|
||||
setFocusStop(true);
|
||||
regenerateLayers();
|
||||
setViewScroll(getViewScroll());
|
||||
setViewScroll(viewScroll());
|
||||
showCurrentCel();
|
||||
}
|
||||
|
||||
@ -423,7 +423,7 @@ bool Timeline::onProcessMessage(Message* msg)
|
||||
// hitTestCel() and limiting the clicked cel inside the
|
||||
// range bounds.
|
||||
if (m_range.type() == Range::kCels) {
|
||||
m_clk = hitTestCel(mouseMsg->position() - getBounds().getOrigin());
|
||||
m_clk = hitTestCel(mouseMsg->position() - bounds().origin());
|
||||
|
||||
if (m_clk.layer < m_range.layerBegin())
|
||||
m_clk.layer = m_range.layerBegin();
|
||||
@ -456,7 +456,7 @@ bool Timeline::onProcessMessage(Message* msg)
|
||||
break;
|
||||
|
||||
gfx::Point mousePos = static_cast<MouseMessage*>(msg)->position()
|
||||
- getBounds().getOrigin();
|
||||
- bounds().origin();
|
||||
|
||||
Hit hit;
|
||||
setHot(hit = hitTest(msg, mousePos));
|
||||
@ -467,7 +467,7 @@ bool Timeline::onProcessMessage(Message* msg)
|
||||
case STATE_SCROLLING: {
|
||||
gfx::Point absMousePos = static_cast<MouseMessage*>(msg)->position();
|
||||
setViewScroll(
|
||||
getViewScroll() - gfx::Point(
|
||||
viewScroll() - gfx::Point(
|
||||
(absMousePos.x - m_oldPos.x),
|
||||
(absMousePos.y - m_oldPos.y)));
|
||||
|
||||
@ -580,7 +580,7 @@ bool Timeline::onProcessMessage(Message* msg)
|
||||
|
||||
case PART_HEADER_GEAR: {
|
||||
gfx::Rect gearBounds =
|
||||
getPartBounds(Hit(PART_HEADER_GEAR)).offset(getBounds().getOrigin());
|
||||
getPartBounds(Hit(PART_HEADER_GEAR)).offset(bounds().origin());
|
||||
|
||||
if (!m_confPopup) {
|
||||
ConfigureTimelinePopup* popup =
|
||||
@ -593,9 +593,9 @@ bool Timeline::onProcessMessage(Message* msg)
|
||||
if (!m_confPopup->isVisible()) {
|
||||
m_confPopup->moveWindow(gfx::Rect(
|
||||
gearBounds.x,
|
||||
gearBounds.y-m_confPopup->getBounds().h,
|
||||
m_confPopup->getBounds().w,
|
||||
m_confPopup->getBounds().h));
|
||||
gearBounds.y-m_confPopup->bounds().h,
|
||||
m_confPopup->bounds().w,
|
||||
m_confPopup->bounds().h));
|
||||
m_confPopup->openWindow();
|
||||
}
|
||||
else
|
||||
@ -722,7 +722,7 @@ bool Timeline::onProcessMessage(Message* msg)
|
||||
|
||||
// Restore the cursor.
|
||||
m_state = STATE_STANDBY;
|
||||
setCursor(msg, hitTest(msg, mouseMsg->position() - getBounds().getOrigin()));
|
||||
setCursor(msg, hitTest(msg, mouseMsg->position() - bounds().origin()));
|
||||
|
||||
releaseMouse();
|
||||
updateStatusBar(msg);
|
||||
@ -790,7 +790,7 @@ bool Timeline::onProcessMessage(Message* msg)
|
||||
}
|
||||
|
||||
updateByMousePos(msg,
|
||||
ui::get_mouse_position() - getBounds().getOrigin());
|
||||
ui::get_mouse_position() - bounds().origin());
|
||||
|
||||
if (used)
|
||||
return true;
|
||||
@ -814,7 +814,7 @@ bool Timeline::onProcessMessage(Message* msg)
|
||||
}
|
||||
|
||||
updateByMousePos(msg,
|
||||
ui::get_mouse_position() - getBounds().getOrigin());
|
||||
ui::get_mouse_position() - bounds().origin());
|
||||
|
||||
if (used)
|
||||
return true;
|
||||
@ -840,7 +840,7 @@ bool Timeline::onProcessMessage(Message* msg)
|
||||
dy *= 3;
|
||||
}
|
||||
|
||||
setViewScroll(getViewScroll() + gfx::Point(dx, dy));
|
||||
setViewScroll(viewScroll() + gfx::Point(dx, dy));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -863,13 +863,13 @@ void Timeline::onSizeHint(SizeHintEvent& ev)
|
||||
|
||||
void Timeline::onResize(ui::ResizeEvent& ev)
|
||||
{
|
||||
gfx::Rect rc = ev.getBounds();
|
||||
gfx::Rect rc = ev.bounds();
|
||||
setBoundsQuietly(rc);
|
||||
|
||||
gfx::Size sz = m_aniControls.sizeHint();
|
||||
m_aniControls.setBounds(
|
||||
gfx::Rect(rc.x, rc.y, MIN(sz.w, m_separator_x),
|
||||
getFont()->height() +
|
||||
font()->height() +
|
||||
skinTheme()->dimensions.timelineTagsAreaHeight()));
|
||||
|
||||
updateScrollBars();
|
||||
@ -877,7 +877,7 @@ void Timeline::onResize(ui::ResizeEvent& ev)
|
||||
|
||||
void Timeline::onPaint(ui::PaintEvent& ev)
|
||||
{
|
||||
Graphics* g = ev.getGraphics();
|
||||
Graphics* g = ev.graphics();
|
||||
bool noDoc = (m_document == NULL);
|
||||
if (noDoc)
|
||||
goto paintNoDoc;
|
||||
@ -1004,12 +1004,12 @@ void Timeline::onPaint(ui::PaintEvent& ev)
|
||||
}
|
||||
catch (const LockedDocumentException&) {
|
||||
noDoc = true;
|
||||
defer_invalid_rect(g->getClipBounds().offset(getBounds().getOrigin()));
|
||||
defer_invalid_rect(g->getClipBounds().offset(bounds().origin()));
|
||||
}
|
||||
|
||||
paintNoDoc:;
|
||||
if (noDoc)
|
||||
drawPart(g, getClientBounds(), NULL,
|
||||
drawPart(g, clientBounds(), NULL,
|
||||
skinTheme()->styles.timelinePadding());
|
||||
}
|
||||
|
||||
@ -1186,8 +1186,8 @@ void Timeline::setCursor(ui::Message* msg, const Hit& hit)
|
||||
|
||||
void Timeline::getDrawableLayers(ui::Graphics* g, LayerIndex* first_layer, LayerIndex* last_layer)
|
||||
{
|
||||
int hpx = (getClientBounds().h - HDRSIZE - topHeight());
|
||||
LayerIndex i = lastLayer() - LayerIndex((getViewScroll().y+hpx) / LAYSIZE);
|
||||
int hpx = (clientBounds().h - HDRSIZE - topHeight());
|
||||
LayerIndex i = lastLayer() - LayerIndex((viewScroll().y+hpx) / LAYSIZE);
|
||||
i = MID(firstLayer(), i, lastLayer());
|
||||
|
||||
LayerIndex j = i + LayerIndex(hpx / LAYSIZE + 1);
|
||||
@ -1202,9 +1202,9 @@ void Timeline::getDrawableLayers(ui::Graphics* g, LayerIndex* first_layer, Layer
|
||||
|
||||
void Timeline::getDrawableFrames(ui::Graphics* g, frame_t* first_frame, frame_t* last_frame)
|
||||
{
|
||||
int availW = (getClientBounds().w - m_separator_x);
|
||||
int availW = (clientBounds().w - m_separator_x);
|
||||
|
||||
*first_frame = frame_t(getViewScroll().x / FRMSIZE);
|
||||
*first_frame = frame_t(viewScroll().x / FRMSIZE);
|
||||
*last_frame = *first_frame + frame_t(availW / FRMSIZE) + ((availW % FRMSIZE) > 0 ? 1: 0);
|
||||
}
|
||||
|
||||
@ -1308,7 +1308,7 @@ void Timeline::drawHeaderFrame(ui::Graphics* g, frame_t frame)
|
||||
char buf[256];
|
||||
std::sprintf(buf, "%d", (frame+1)%100); // Draw only the first two digits.
|
||||
|
||||
she::Font* oldFont = g->getFont();
|
||||
she::Font* oldFont = g->font();
|
||||
g->setFont(skinTheme()->getMiniFont());
|
||||
drawPart(g, bounds, buf, skinTheme()->styles.timelineBox(), is_active, is_hover, is_clicked);
|
||||
g->setFont(oldFont);
|
||||
@ -1365,7 +1365,7 @@ void Timeline::drawLayer(ui::Graphics* g, LayerIndex layerIdx)
|
||||
skinTheme()->colors.timelineNormalText(),
|
||||
gfx::Rect(bounds.x+4*s,
|
||||
bounds.y+bounds.h-2*s,
|
||||
getFont()->textLength(layer->name().c_str()), s));
|
||||
font()->textLength(layer->name().c_str()), s));
|
||||
}
|
||||
|
||||
// If this layer wasn't clicked but there are another layer clicked,
|
||||
@ -1474,8 +1474,8 @@ void Timeline::drawFrameTags(ui::Graphics* g)
|
||||
|
||||
g->fillRect(theme->colors.workspace(),
|
||||
gfx::Rect(
|
||||
0, getFont()->height(),
|
||||
getClientBounds().w,
|
||||
0, font()->height(),
|
||||
clientBounds().w,
|
||||
theme->dimensions.timelineTagsAreaHeight()));
|
||||
|
||||
for (FrameTag* frameTag : m_sprite->frameTags()) {
|
||||
@ -1515,7 +1515,7 @@ void Timeline::drawFrameTags(ui::Graphics* g)
|
||||
frameTag->name(),
|
||||
color_utils::blackandwhite_neg(bg),
|
||||
gfx::ColorNone,
|
||||
bounds.getOrigin());
|
||||
bounds.origin());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1590,7 +1590,7 @@ void Timeline::drawPaddings(ui::Graphics* g)
|
||||
{
|
||||
SkinTheme::Styles& styles = skinTheme()->styles;
|
||||
|
||||
gfx::Rect client = getClientBounds();
|
||||
gfx::Rect client = clientBounds();
|
||||
gfx::Rect bottomLayer;
|
||||
gfx::Rect lastFrame;
|
||||
int top = topHeight();
|
||||
@ -1624,7 +1624,7 @@ void Timeline::drawPaddings(ui::Graphics* g)
|
||||
|
||||
gfx::Rect Timeline::getLayerHeadersBounds() const
|
||||
{
|
||||
gfx::Rect rc = getClientBounds();
|
||||
gfx::Rect rc = clientBounds();
|
||||
rc.w = m_separator_x;
|
||||
int h = topHeight() + HDRSIZE;
|
||||
rc.y += h;
|
||||
@ -1634,7 +1634,7 @@ gfx::Rect Timeline::getLayerHeadersBounds() const
|
||||
|
||||
gfx::Rect Timeline::getFrameHeadersBounds() const
|
||||
{
|
||||
gfx::Rect rc = getClientBounds();
|
||||
gfx::Rect rc = clientBounds();
|
||||
rc.x += m_separator_x;
|
||||
rc.y += topHeight();
|
||||
rc.w -= m_separator_x;
|
||||
@ -1663,7 +1663,7 @@ gfx::Rect Timeline::getOnionskinFramesBounds() const
|
||||
|
||||
gfx::Rect Timeline::getCelsBounds() const
|
||||
{
|
||||
gfx::Rect rc = getClientBounds();
|
||||
gfx::Rect rc = clientBounds();
|
||||
rc.x += m_separator_x;
|
||||
rc.w -= m_separator_x;
|
||||
rc.y += HDRSIZE + topHeight();
|
||||
@ -1673,7 +1673,7 @@ gfx::Rect Timeline::getCelsBounds() const
|
||||
|
||||
gfx::Rect Timeline::getPartBounds(const Hit& hit) const
|
||||
{
|
||||
gfx::Rect bounds = getClientBounds();
|
||||
gfx::Rect bounds = clientBounds();
|
||||
int y = topHeight();
|
||||
|
||||
switch (hit.part) {
|
||||
@ -1710,7 +1710,7 @@ gfx::Rect Timeline::getPartBounds(const Hit& hit) const
|
||||
case PART_HEADER_FRAME:
|
||||
return gfx::Rect(
|
||||
bounds.x + m_separator_x + m_separator_w - 1
|
||||
+ FRMSIZE*MAX(firstFrame(), hit.frame) - getViewScroll().x,
|
||||
+ FRMSIZE*MAX(firstFrame(), hit.frame) - viewScroll().x,
|
||||
bounds.y + y, FRMSIZE, HDRSIZE);
|
||||
|
||||
case PART_HEADER_FRAME_TAGS:
|
||||
@ -1722,7 +1722,7 @@ gfx::Rect Timeline::getPartBounds(const Hit& hit) const
|
||||
case PART_LAYER:
|
||||
if (validLayer(hit.layer)) {
|
||||
return gfx::Rect(bounds.x,
|
||||
bounds.y + y + HDRSIZE + LAYSIZE*(lastLayer()-hit.layer) - getViewScroll().y,
|
||||
bounds.y + y + HDRSIZE + LAYSIZE*(lastLayer()-hit.layer) - viewScroll().y,
|
||||
m_separator_x, LAYSIZE);
|
||||
}
|
||||
break;
|
||||
@ -1730,7 +1730,7 @@ gfx::Rect Timeline::getPartBounds(const Hit& hit) const
|
||||
case PART_LAYER_EYE_ICON:
|
||||
if (validLayer(hit.layer)) {
|
||||
return gfx::Rect(bounds.x,
|
||||
bounds.y + y + HDRSIZE + LAYSIZE*(lastLayer()-hit.layer) - getViewScroll().y,
|
||||
bounds.y + y + HDRSIZE + LAYSIZE*(lastLayer()-hit.layer) - viewScroll().y,
|
||||
FRMSIZE, LAYSIZE);
|
||||
}
|
||||
break;
|
||||
@ -1738,7 +1738,7 @@ gfx::Rect Timeline::getPartBounds(const Hit& hit) const
|
||||
case PART_LAYER_PADLOCK_ICON:
|
||||
if (validLayer(hit.layer)) {
|
||||
return gfx::Rect(bounds.x + FRMSIZE,
|
||||
bounds.y + y + HDRSIZE + LAYSIZE*(lastLayer()-hit.layer) - getViewScroll().y,
|
||||
bounds.y + y + HDRSIZE + LAYSIZE*(lastLayer()-hit.layer) - viewScroll().y,
|
||||
FRMSIZE, LAYSIZE);
|
||||
}
|
||||
break;
|
||||
@ -1746,7 +1746,7 @@ gfx::Rect Timeline::getPartBounds(const Hit& hit) const
|
||||
case PART_LAYER_CONTINUOUS_ICON:
|
||||
if (validLayer(hit.layer)) {
|
||||
return gfx::Rect(bounds.x + 2*FRMSIZE,
|
||||
bounds.y + y + HDRSIZE + LAYSIZE*(lastLayer()-hit.layer) - getViewScroll().y,
|
||||
bounds.y + y + HDRSIZE + LAYSIZE*(lastLayer()-hit.layer) - viewScroll().y,
|
||||
FRMSIZE, LAYSIZE);
|
||||
}
|
||||
break;
|
||||
@ -1755,7 +1755,7 @@ gfx::Rect Timeline::getPartBounds(const Hit& hit) const
|
||||
if (validLayer(hit.layer)) {
|
||||
int x = FRMSIZE*3;
|
||||
return gfx::Rect(bounds.x + x,
|
||||
bounds.y + y + HDRSIZE + LAYSIZE*(lastLayer()-hit.layer) - getViewScroll().y,
|
||||
bounds.y + y + HDRSIZE + LAYSIZE*(lastLayer()-hit.layer) - viewScroll().y,
|
||||
m_separator_x - x, LAYSIZE);
|
||||
}
|
||||
break;
|
||||
@ -1763,8 +1763,8 @@ gfx::Rect Timeline::getPartBounds(const Hit& hit) const
|
||||
case PART_CEL:
|
||||
if (validLayer(hit.layer) && hit.frame >= frame_t(0)) {
|
||||
return gfx::Rect(
|
||||
bounds.x + m_separator_x + m_separator_w - 1 + FRMSIZE*hit.frame - getViewScroll().x,
|
||||
bounds.y + y + HDRSIZE + LAYSIZE*(lastLayer()-hit.layer) - getViewScroll().y,
|
||||
bounds.x + m_separator_x + m_separator_w - 1 + FRMSIZE*hit.frame - viewScroll().x,
|
||||
bounds.y + y + HDRSIZE + LAYSIZE*(lastLayer()-hit.layer) - viewScroll().y,
|
||||
FRMSIZE, LAYSIZE);
|
||||
}
|
||||
break;
|
||||
@ -1786,11 +1786,11 @@ gfx::Rect Timeline::getPartBounds(const Hit& hit) const
|
||||
gfx::Rect bounds = bounds1.createUnion(bounds2);
|
||||
bounds.y -= skinTheme()->dimensions.timelineTagsAreaHeight();
|
||||
|
||||
int textHeight = getFont()->height();
|
||||
int textHeight = font()->height();
|
||||
bounds.y -= textHeight + 2*ui::guiscale();
|
||||
bounds.x += 3*ui::guiscale();
|
||||
bounds.w = getFont()->textLength(frameTag->name().c_str()) + 4*ui::guiscale();
|
||||
bounds.h = getFont()->height() + 2*ui::guiscale();
|
||||
bounds.w = font()->textLength(frameTag->name().c_str()) + 4*ui::guiscale();
|
||||
bounds.h = font()->height() + 2*ui::guiscale();
|
||||
return bounds;
|
||||
}
|
||||
break;
|
||||
@ -1824,7 +1824,7 @@ gfx::Rect Timeline::getRangeBounds(const Range& range) const
|
||||
|
||||
void Timeline::invalidateHit(const Hit& hit)
|
||||
{
|
||||
invalidateRect(getPartBounds(hit).offset(getOrigin()));
|
||||
invalidateRect(getPartBounds(hit).offset(origin()));
|
||||
}
|
||||
|
||||
void Timeline::regenerateLayers()
|
||||
@ -1848,8 +1848,8 @@ void Timeline::regenerateLayers()
|
||||
|
||||
void Timeline::updateScrollBars()
|
||||
{
|
||||
gfx::Rect rc = getBounds();
|
||||
m_viewportArea = getCelsBounds().offset(rc.getOrigin());
|
||||
gfx::Rect rc = bounds();
|
||||
m_viewportArea = getCelsBounds().offset(rc.origin());
|
||||
ui::setup_scrollbars(getScrollableSize(),
|
||||
m_viewportArea, *this,
|
||||
m_hbar,
|
||||
@ -1878,7 +1878,7 @@ Timeline::Hit Timeline::hitTest(ui::Message* msg, const gfx::Point& mousePos)
|
||||
hit.part = PART_SEPARATOR;
|
||||
}
|
||||
else {
|
||||
gfx::Point scroll = getViewScroll();
|
||||
gfx::Point scroll = viewScroll();
|
||||
int top = topHeight();
|
||||
|
||||
hit.layer = lastLayer() - LayerIndex(
|
||||
@ -1994,7 +1994,7 @@ Timeline::Hit Timeline::hitTestCel(const gfx::Point& mousePos)
|
||||
if (!m_document)
|
||||
return hit;
|
||||
|
||||
gfx::Point scroll = getViewScroll();
|
||||
gfx::Point scroll = viewScroll();
|
||||
int top = topHeight();
|
||||
|
||||
hit.layer = lastLayer() - LayerIndex(
|
||||
@ -2171,7 +2171,7 @@ void Timeline::updateStatusBar(ui::Message* msg)
|
||||
|
||||
void Timeline::showCel(LayerIndex layer, frame_t frame)
|
||||
{
|
||||
gfx::Point scroll = getViewScroll();
|
||||
gfx::Point scroll = viewScroll();
|
||||
|
||||
gfx::Rect viewport = m_viewportArea;
|
||||
|
||||
@ -2222,8 +2222,8 @@ gfx::Size Timeline::getScrollableSize() const
|
||||
{
|
||||
if (m_sprite) {
|
||||
return gfx::Size(
|
||||
m_sprite->totalFrames() * FRMSIZE + getBounds().w/2,
|
||||
m_layers.size() * LAYSIZE + getBounds().h/2);
|
||||
m_sprite->totalFrames() * FRMSIZE + bounds().w/2,
|
||||
m_layers.size() * LAYSIZE + bounds().h/2);
|
||||
}
|
||||
else
|
||||
return gfx::Size(0, 0);
|
||||
@ -2233,8 +2233,8 @@ gfx::Point Timeline::getMaxScrollablePos() const
|
||||
{
|
||||
if (m_sprite) {
|
||||
gfx::Size size = getScrollableSize();
|
||||
int max_scroll_x = size.w - getBounds().w/2;
|
||||
int max_scroll_y = size.h - getBounds().h/2;
|
||||
int max_scroll_x = size.w - bounds().w/2;
|
||||
int max_scroll_y = size.h - bounds().h/2;
|
||||
max_scroll_x = MAX(0, max_scroll_x);
|
||||
max_scroll_y = MAX(0, max_scroll_y);
|
||||
return gfx::Point(max_scroll_x, max_scroll_y);
|
||||
@ -2361,19 +2361,19 @@ void Timeline::dropRange(DropOp op)
|
||||
}
|
||||
}
|
||||
|
||||
gfx::Size Timeline::getVisibleSize() const
|
||||
gfx::Size Timeline::visibleSize() const
|
||||
{
|
||||
return getCelsBounds().getSize();
|
||||
return getCelsBounds().size();
|
||||
}
|
||||
|
||||
gfx::Point Timeline::getViewScroll() const
|
||||
gfx::Point Timeline::viewScroll() const
|
||||
{
|
||||
return gfx::Point(m_hbar.getPos(), m_vbar.getPos());
|
||||
}
|
||||
|
||||
void Timeline::setViewScroll(const gfx::Point& pt)
|
||||
{
|
||||
const gfx::Point oldScroll = getViewScroll();
|
||||
const gfx::Point oldScroll = viewScroll();
|
||||
const gfx::Point maxPos = getMaxScrollablePos();
|
||||
gfx::Point newScroll = pt;
|
||||
newScroll.x = MID(0, newScroll.x, maxPos.x);
|
||||
@ -2494,7 +2494,7 @@ DocumentPreferences& Timeline::docPref() const
|
||||
|
||||
skin::SkinTheme* Timeline::skinTheme() const
|
||||
{
|
||||
return static_cast<SkinTheme*>(getTheme());
|
||||
return static_cast<SkinTheme*>(theme());
|
||||
}
|
||||
|
||||
int Timeline::topHeight() const
|
||||
@ -2502,7 +2502,7 @@ int Timeline::topHeight() const
|
||||
int h = 0;
|
||||
if (m_document && m_sprite) {
|
||||
h += skinTheme()->dimensions.timelineTopBorder();
|
||||
h += getFont()->height();
|
||||
h += font()->height();
|
||||
h += skinTheme()->dimensions.timelineTagsAreaHeight();
|
||||
}
|
||||
return h;
|
||||
|
@ -99,8 +99,8 @@ namespace app {
|
||||
void dropRange(DropOp op);
|
||||
|
||||
// ScrollableViewDelegate impl
|
||||
gfx::Size getVisibleSize() const override;
|
||||
gfx::Point getViewScroll() const override;
|
||||
gfx::Size visibleSize() const override;
|
||||
gfx::Point viewScroll() const override;
|
||||
void setViewScroll(const gfx::Point& pt) override;
|
||||
|
||||
protected:
|
||||
|
@ -65,7 +65,7 @@ private:
|
||||
|
||||
static Size getToolIconSize(Widget* widget)
|
||||
{
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(widget->getTheme());
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(widget->theme());
|
||||
she::Surface* icon = theme->getToolIcon("configuration");
|
||||
if (icon)
|
||||
return Size(icon->width(), icon->height());
|
||||
@ -215,7 +215,7 @@ bool ToolBar::onProcessMessage(Message* msg)
|
||||
// mouse over the ToolBar.
|
||||
if (hasCapture()) {
|
||||
MouseMessage* mouseMsg = static_cast<MouseMessage*>(msg);
|
||||
Widget* pick = getManager()->pick(mouseMsg->position());
|
||||
Widget* pick = manager()->pick(mouseMsg->position());
|
||||
if (ToolStrip* strip = dynamic_cast<ToolStrip*>(pick)) {
|
||||
releaseMouse();
|
||||
|
||||
@ -225,7 +225,7 @@ bool ToolBar::onProcessMessage(Message* msg)
|
||||
mouseMsg->modifiers(),
|
||||
mouseMsg->position());
|
||||
mouseMsg2->addRecipient(strip);
|
||||
getManager()->enqueueMessage(mouseMsg2);
|
||||
manager()->enqueueMessage(mouseMsg2);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -286,9 +286,9 @@ void ToolBar::onSizeHint(SizeHintEvent& ev)
|
||||
|
||||
void ToolBar::onPaint(ui::PaintEvent& ev)
|
||||
{
|
||||
gfx::Rect bounds = getClientBounds();
|
||||
Graphics* g = ev.getGraphics();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->getTheme());
|
||||
gfx::Rect bounds = clientBounds();
|
||||
Graphics* g = ev.graphics();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
gfx::Color normalFace = theme->colors.buttonNormalFace();
|
||||
gfx::Color hotFace = theme->colors.buttonHotFace();
|
||||
ToolBox* toolbox = App::instance()->getToolBox();
|
||||
@ -315,7 +315,7 @@ void ToolBar::onPaint(ui::PaintEvent& ev)
|
||||
}
|
||||
|
||||
toolrc = getToolGroupBounds(c);
|
||||
toolrc.offset(-getBounds().x, -getBounds().y);
|
||||
toolrc.offset(-origin());
|
||||
theme->drawRect(g, toolrc, nw.get(), face);
|
||||
|
||||
// Draw the tool icon
|
||||
@ -329,7 +329,7 @@ void ToolBar::onPaint(ui::PaintEvent& ev)
|
||||
|
||||
// Draw button to show/hide preview
|
||||
toolrc = getToolGroupBounds(PreviewVisibilityIndex);
|
||||
toolrc.offset(-getBounds().x, -getBounds().y);
|
||||
toolrc.offset(-origin());
|
||||
bool isHot = (m_hotIndex == PreviewVisibilityIndex ||
|
||||
App::instance()->getMainWindow()->getPreviewEditor()->isPreviewEnabled());
|
||||
theme->drawRect(
|
||||
@ -409,7 +409,7 @@ void ToolBar::openPopupWindow(int group_index, ToolGroup* tool_group)
|
||||
for (ToolIterator it = toolbox->begin(); it != toolbox->end(); ++it) {
|
||||
Tool* tool = *it;
|
||||
if (tool->getGroup() == tool_group)
|
||||
w += getBounds().w-border().width()-1;
|
||||
w += bounds().w-border().width()-1;
|
||||
}
|
||||
|
||||
rc.x -= w;
|
||||
@ -417,7 +417,7 @@ void ToolBar::openPopupWindow(int group_index, ToolGroup* tool_group)
|
||||
|
||||
// Set hotregion of popup window
|
||||
Region rgn(gfx::Rect(rc).enlarge(16*guiscale()));
|
||||
rgn.createUnion(rgn, Region(getBounds()));
|
||||
rgn.createUnion(rgn, Region(bounds()));
|
||||
m_popupWindow->setHotRegion(rgn);
|
||||
|
||||
m_popupWindow->setTransparent(true);
|
||||
@ -435,7 +435,7 @@ Rect ToolBar::getToolGroupBounds(int group_index)
|
||||
ToolBox* toolbox = App::instance()->getToolBox();
|
||||
int groups = toolbox->getGroupsCount();
|
||||
Size iconsize = getToolIconSize(this);
|
||||
Rect rc(getBounds());
|
||||
Rect rc(bounds());
|
||||
rc.shrink(border());
|
||||
|
||||
switch (group_index) {
|
||||
@ -510,13 +510,13 @@ void ToolBar::openTipWindow(int group_index, Tool* tool)
|
||||
Rect toolrc = getToolGroupBounds(group_index);
|
||||
Point arrow = tool ? getToolPositionInGroup(group_index, tool): Point(0, 0);
|
||||
|
||||
m_tipWindow = new TipWindow(tooltip, gfx::Rect(arrow, toolrc.getSize()));
|
||||
m_tipWindow = new TipWindow(tooltip, gfx::Rect(arrow, toolrc.size()));
|
||||
m_tipWindow->setArrowAlign(TOP | RIGHT);
|
||||
m_tipWindow->remapWindow();
|
||||
|
||||
int w = m_tipWindow->getBounds().w;
|
||||
int h = m_tipWindow->getBounds().h;
|
||||
int x = toolrc.x - w + (tool && m_popupWindow && m_popupWindow->isVisible() ? arrow.x-m_popupWindow->getBounds().w: 0);
|
||||
int w = m_tipWindow->bounds().w;
|
||||
int h = m_tipWindow->bounds().h;
|
||||
int x = toolrc.x - w + (tool && m_popupWindow && m_popupWindow->isVisible() ? arrow.x-m_popupWindow->bounds().w: 0);
|
||||
int y = toolrc.y + toolrc.h;
|
||||
|
||||
m_tipWindow->positionWindow(MID(0, x, ui::display_w()-w),
|
||||
@ -634,7 +634,7 @@ bool ToolBar::ToolStrip::onProcessMessage(Message* msg)
|
||||
if (m_hotTool)
|
||||
m_toolbar->selectTool(m_hotTool);
|
||||
|
||||
Widget* pick = getManager()->pick(mouseMsg->position());
|
||||
Widget* pick = manager()->pick(mouseMsg->position());
|
||||
if (ToolBar* bar = dynamic_cast<ToolBar*>(pick)) {
|
||||
releaseMouse();
|
||||
|
||||
@ -644,7 +644,7 @@ bool ToolBar::ToolStrip::onProcessMessage(Message* msg)
|
||||
mouseMsg->modifiers(),
|
||||
mouseMsg->position());
|
||||
mouseMsg2->addRecipient(bar);
|
||||
getManager()->enqueueMessage(mouseMsg2);
|
||||
manager()->enqueueMessage(mouseMsg2);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -679,8 +679,8 @@ void ToolBar::ToolStrip::onSizeHint(SizeHintEvent& ev)
|
||||
|
||||
void ToolBar::ToolStrip::onPaint(PaintEvent& ev)
|
||||
{
|
||||
Graphics* g = ev.getGraphics();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
Graphics* g = ev.graphics();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
ToolBox* toolbox = App::instance()->getToolBox();
|
||||
Rect toolrc;
|
||||
int index = 0;
|
||||
@ -702,7 +702,7 @@ void ToolBar::ToolStrip::onPaint(PaintEvent& ev)
|
||||
}
|
||||
|
||||
toolrc = getToolBounds(index++);
|
||||
toolrc.offset(-getBounds().x, -getBounds().y);
|
||||
toolrc.offset(-bounds().x, -bounds().y);
|
||||
theme->drawRect(g, toolrc, nw.get(), face);
|
||||
|
||||
// Draw the tool icon
|
||||
@ -719,7 +719,7 @@ void ToolBar::ToolStrip::onPaint(PaintEvent& ev)
|
||||
|
||||
Rect ToolBar::ToolStrip::getToolBounds(int index)
|
||||
{
|
||||
const Rect& bounds(getBounds());
|
||||
const Rect& bounds(this->bounds());
|
||||
Size iconsize = getToolIconSize(this);
|
||||
|
||||
return Rect(bounds.x+index*(iconsize.w-1), bounds.y,
|
||||
|
@ -42,7 +42,7 @@ Workspace::Workspace()
|
||||
, m_dropPreviewPanel(nullptr)
|
||||
, m_dropPreviewTabs(nullptr)
|
||||
{
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
setBgColor(theme->colors.workspace());
|
||||
|
||||
addChild(&m_mainPanel);
|
||||
@ -156,14 +156,14 @@ void Workspace::updateTabs()
|
||||
|
||||
void Workspace::onPaint(PaintEvent& ev)
|
||||
{
|
||||
ev.getGraphics()->fillRect(getBgColor(), getClientBounds());
|
||||
ev.graphics()->fillRect(bgColor(), clientBounds());
|
||||
}
|
||||
|
||||
void Workspace::onResize(ui::ResizeEvent& ev)
|
||||
{
|
||||
setBoundsQuietly(ev.getBounds());
|
||||
setBoundsQuietly(ev.bounds());
|
||||
|
||||
gfx::Rect rc = getChildrenBounds();
|
||||
gfx::Rect rc = childrenBounds();
|
||||
for (auto child : children())
|
||||
child->setBounds(rc);
|
||||
}
|
||||
@ -271,31 +271,31 @@ WorkspacePanel* Workspace::getViewPanel(WorkspaceView* view)
|
||||
if (widget->type() == WorkspacePanel::Type())
|
||||
return static_cast<WorkspacePanel*>(widget);
|
||||
|
||||
widget = widget->getParent();
|
||||
widget = widget->parent();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
WorkspacePanel* Workspace::getPanelAt(const gfx::Point& pos)
|
||||
{
|
||||
Widget* widget = getManager()->pick(pos);
|
||||
Widget* widget = manager()->pick(pos);
|
||||
while (widget) {
|
||||
if (widget->type() == WorkspacePanel::Type())
|
||||
return static_cast<WorkspacePanel*>(widget);
|
||||
|
||||
widget = widget->getParent();
|
||||
widget = widget->parent();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
WorkspaceTabs* Workspace::getTabsAt(const gfx::Point& pos)
|
||||
{
|
||||
Widget* widget = getManager()->pick(pos);
|
||||
Widget* widget = manager()->pick(pos);
|
||||
while (widget) {
|
||||
if (widget->type() == Tabs::Type())
|
||||
return static_cast<WorkspaceTabs*>(widget);
|
||||
|
||||
widget = widget->getParent();
|
||||
widget = widget->parent();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ WorkspacePanel::WorkspacePanel(PanelType panelType)
|
||||
, m_topTime(0)
|
||||
, m_bottomTime(0)
|
||||
{
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
|
||||
setBgColor(theme->colors.workspace());
|
||||
}
|
||||
|
||||
@ -107,18 +107,18 @@ void WorkspacePanel::removeView(WorkspaceView* view)
|
||||
|
||||
// Destroy this panel
|
||||
if (m_views.empty() && m_panelType == SUB_PANEL) {
|
||||
Widget* self = getParent();
|
||||
Widget* self = parent();
|
||||
ASSERT(self->type() == kBoxWidget);
|
||||
|
||||
Widget* splitter = self->getParent();
|
||||
Widget* splitter = self->parent();
|
||||
ASSERT(splitter->type() == kSplitterWidget);
|
||||
|
||||
Widget* parent = splitter->getParent();
|
||||
Widget* parent = splitter->parent();
|
||||
|
||||
Widget* side =
|
||||
(splitter->getFirstChild() == self ?
|
||||
splitter->getLastChild():
|
||||
splitter->getFirstChild());
|
||||
(splitter->firstChild() == self ?
|
||||
splitter->lastChild():
|
||||
splitter->firstChild());
|
||||
|
||||
splitter->removeChild(side);
|
||||
parent->replaceChild(splitter, side);
|
||||
@ -149,18 +149,18 @@ void WorkspacePanel::setActiveView(WorkspaceView* view)
|
||||
|
||||
void WorkspacePanel::onPaint(PaintEvent& ev)
|
||||
{
|
||||
ev.getGraphics()->fillRect(getBgColor(), getClientBounds());
|
||||
ev.graphics()->fillRect(bgColor(), clientBounds());
|
||||
}
|
||||
|
||||
void WorkspacePanel::onResize(ui::ResizeEvent& ev)
|
||||
{
|
||||
setBoundsQuietly(ev.getBounds());
|
||||
setBoundsQuietly(ev.bounds());
|
||||
adjustActiveViewBounds();
|
||||
}
|
||||
|
||||
void WorkspacePanel::adjustActiveViewBounds()
|
||||
{
|
||||
gfx::Rect rc = getChildrenBounds();
|
||||
gfx::Rect rc = childrenBounds();
|
||||
|
||||
// Preview to drop tabs in workspace
|
||||
if (m_leftTime+m_topTime+m_rightTime+m_bottomTime > 1e-4) {
|
||||
@ -269,10 +269,10 @@ DropViewAtResult WorkspacePanel::dropViewAt(const gfx::Point& pos, WorkspacePane
|
||||
Splitter* splitter = new Splitter(Splitter::ByPercentage, splitterAlign);
|
||||
splitter->setExpansive(true);
|
||||
|
||||
Widget* parent = getParent();
|
||||
Widget* parent = this->parent();
|
||||
if (parent->type() == kBoxWidget) {
|
||||
self = parent;
|
||||
parent = self->getParent();
|
||||
parent = self->parent();
|
||||
ASSERT(parent->type() == kSplitterWidget);
|
||||
}
|
||||
if (parent->type() == Workspace::Type() ||
|
||||
@ -315,7 +315,7 @@ DropViewAtResult WorkspacePanel::dropViewAt(const gfx::Point& pos, WorkspacePane
|
||||
|
||||
int WorkspacePanel::calculateDropArea(const gfx::Point& pos) const
|
||||
{
|
||||
gfx::Rect rc = getChildrenBounds();
|
||||
gfx::Rect rc = childrenBounds();
|
||||
if (rc.contains(pos)) {
|
||||
int left = ABS(rc.x - pos.x);
|
||||
int top = ABS(rc.y - pos.y);
|
||||
@ -342,7 +342,7 @@ int WorkspacePanel::calculateDropArea(const gfx::Point& pos) const
|
||||
|
||||
int WorkspacePanel::getDropThreshold() const
|
||||
{
|
||||
gfx::Rect cpos = getChildrenBounds();
|
||||
gfx::Rect cpos = childrenBounds();
|
||||
int threshold = 32*guiscale();
|
||||
if (threshold > cpos.w/2) threshold = cpos.w/2;
|
||||
if (threshold > cpos.h/2) threshold = cpos.h/2;
|
||||
@ -356,7 +356,7 @@ Workspace* WorkspacePanel::getWorkspace()
|
||||
if (widget->type() == Workspace::Type())
|
||||
return static_cast<Workspace*>(widget);
|
||||
|
||||
widget = widget->getParent();
|
||||
widget = widget->parent();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ void ExpandCelCanvas::commit()
|
||||
// If the size of each image is the same, we can create an undo
|
||||
// with only the differences between both images.
|
||||
if (m_cel->position() == m_origCelPos &&
|
||||
m_bounds.getOrigin() == m_origCelPos &&
|
||||
m_bounds.origin() == m_origCelPos &&
|
||||
m_celImage->width() == m_dstImage->width() &&
|
||||
m_celImage->height() == m_dstImage->height()) {
|
||||
int dx = -m_bounds.x + m_origCelPos.x;
|
||||
@ -255,7 +255,7 @@ void ExpandCelCanvas::validateSourceCanvas(const gfx::Region& rgn)
|
||||
getSourceCanvas();
|
||||
|
||||
gfx::Region rgnToValidate(rgn);
|
||||
rgnToValidate.offset(-m_bounds.getOrigin());
|
||||
rgnToValidate.offset(-m_bounds.origin());
|
||||
rgnToValidate.createSubtraction(rgnToValidate, m_validSrcRegion);
|
||||
rgnToValidate.createIntersection(rgnToValidate, gfx::Region(m_srcImage->bounds()));
|
||||
|
||||
@ -264,7 +264,7 @@ void ExpandCelCanvas::validateSourceCanvas(const gfx::Region& rgn)
|
||||
rgnToClear.createSubtraction(rgnToValidate,
|
||||
gfx::Region(m_celImage->bounds()
|
||||
.offset(m_origCelPos)
|
||||
.offset(-m_bounds.getOrigin())));
|
||||
.offset(-m_bounds.origin())));
|
||||
for (const auto& rc : rgnToClear)
|
||||
fill_rect(m_srcImage.get(), rc, m_srcImage->maskColor());
|
||||
|
||||
@ -301,7 +301,7 @@ void ExpandCelCanvas::validateDestCanvas(const gfx::Region& rgn)
|
||||
getDestCanvas();
|
||||
|
||||
gfx::Region rgnToValidate(rgn);
|
||||
rgnToValidate.offset(-m_bounds.getOrigin());
|
||||
rgnToValidate.offset(-m_bounds.origin());
|
||||
rgnToValidate.createSubtraction(rgnToValidate, m_validDstRegion);
|
||||
rgnToValidate.createIntersection(rgnToValidate, gfx::Region(m_dstImage->bounds()));
|
||||
|
||||
@ -310,7 +310,7 @@ void ExpandCelCanvas::validateDestCanvas(const gfx::Region& rgn)
|
||||
rgnToClear.createSubtraction(rgnToValidate,
|
||||
gfx::Region(src->bounds()
|
||||
.offset(src_x, src_y)
|
||||
.offset(-m_bounds.getOrigin())));
|
||||
.offset(-m_bounds.origin())));
|
||||
for (const auto& rc : rgnToClear)
|
||||
fill_rect(m_dstImage.get(), rc, m_dstImage->maskColor());
|
||||
|
||||
@ -336,14 +336,14 @@ void ExpandCelCanvas::invalidateDestCanvas()
|
||||
void ExpandCelCanvas::invalidateDestCanvas(const gfx::Region& rgn)
|
||||
{
|
||||
gfx::Region rgnToInvalidate(rgn);
|
||||
rgnToInvalidate.offset(-m_bounds.getOrigin());
|
||||
rgnToInvalidate.offset(-m_bounds.origin());
|
||||
m_validDstRegion.createSubtraction(m_validDstRegion, rgnToInvalidate);
|
||||
}
|
||||
|
||||
void ExpandCelCanvas::copyValidDestToSourceCanvas(const gfx::Region& rgn)
|
||||
{
|
||||
gfx::Region rgn2(rgn);
|
||||
rgn2.offset(-m_bounds.getOrigin());
|
||||
rgn2.offset(-m_bounds.origin());
|
||||
rgn2.createIntersection(rgn2, m_validSrcRegion);
|
||||
rgn2.createIntersection(rgn2, m_validDstRegion);
|
||||
for (const auto& rc : rgn2)
|
||||
|
@ -136,7 +136,7 @@ Widget* WidgetLoader::convertXmlElementToWidget(const TiXmlElement* elem, Widget
|
||||
if (!widget)
|
||||
widget = new Box(align);
|
||||
else
|
||||
widget->setAlign(widget->getAlign() | align);
|
||||
widget->setAlign(widget->align() | align);
|
||||
}
|
||||
else if (elem_name == "vbox") {
|
||||
if (!widget)
|
||||
@ -367,7 +367,7 @@ Widget* WidgetLoader::convertXmlElementToWidget(const TiXmlElement* elem, Widget
|
||||
widget = new Separator(text ? text: "", align);
|
||||
}
|
||||
else
|
||||
widget->setAlign(widget->getAlign() | align);
|
||||
widget->setAlign(widget->align() | align);
|
||||
}
|
||||
else if (elem_name == "slider") {
|
||||
const char *min = elem->Attribute("min");
|
||||
@ -386,7 +386,7 @@ Widget* WidgetLoader::convertXmlElementToWidget(const TiXmlElement* elem, Widget
|
||||
widget->setText(elem->GetText());
|
||||
|
||||
if (wordwrap)
|
||||
widget->setAlign(widget->getAlign() | WORDWRAP);
|
||||
widget->setAlign(widget->align() | WORDWRAP);
|
||||
}
|
||||
else if (elem_name == "view") {
|
||||
if (!widget)
|
||||
@ -543,7 +543,7 @@ void WidgetLoader::fillWidgetWithXmlElementAttributes(const TiXmlElement* elem,
|
||||
widget->setExpansive(true);
|
||||
|
||||
if (homogeneous)
|
||||
widget->setAlign(widget->getAlign() | HOMOGENEOUS);
|
||||
widget->setAlign(widget->align() | HOMOGENEOUS);
|
||||
|
||||
if (magnet)
|
||||
widget->setFocusMagnet(true);
|
||||
@ -572,7 +572,7 @@ void WidgetLoader::fillWidgetWithXmlElementAttributes(const TiXmlElement* elem,
|
||||
}
|
||||
|
||||
if (styleid) {
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(root->getTheme());
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(root->theme());
|
||||
skin::Style* style = theme->getStyle(styleid);
|
||||
ASSERT(style);
|
||||
SkinStylePropertyPtr prop(new SkinStyleProperty(style));
|
||||
|
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