本文整理汇总了C++中IDocumentSettings类的典型用法代码示例。如果您正苦于以下问题:C++ IDocumentSettings类的具体用法?C++ IDocumentSettings怎么用?C++ IDocumentSettings使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IDocumentSettings类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: window
void GridSettingsCommand::onExecute(Context* context)
{
base::UniquePtr<Window> window(app::load_widget<Window>("grid_settings.xml", "grid_settings"));
Widget* button_ok = app::find_widget<Widget>(window, "ok");
Widget* grid_x = app::find_widget<Widget>(window, "grid_x");
Widget* grid_y = app::find_widget<Widget>(window, "grid_y");
Widget* grid_w = app::find_widget<Widget>(window, "grid_w");
Widget* grid_h = app::find_widget<Widget>(window, "grid_h");
IDocumentSettings* docSettings = context->settings()->getDocumentSettings(context->activeDocument());
Rect bounds = docSettings->getGridBounds();
grid_x->setTextf("%d", bounds.x);
grid_y->setTextf("%d", bounds.y);
grid_w->setTextf("%d", bounds.w);
grid_h->setTextf("%d", bounds.h);
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.w = MAX(bounds.w, 1);
bounds.h = MAX(bounds.h, 1);
docSettings->setGridBounds(bounds);
}
}
示例2: docSettings
void ConfigureTimelinePopup::onResetOnionskin()
{
IDocumentSettings* docSet = docSettings();
if (docSet) {
docSet->setDefaultOnionskinSettings();
updateWidgetsFromCurrentSettings();
}
}
示例3: onExecute
void onExecute(Context* context)
{
IDocumentSettings* docSettings = context->settings()->getDocumentSettings(context->activeDocument());
char buf[512];
docSettings->setSnapToGrid(docSettings->getSnapToGrid() ? false: true);
usprintf(buf, "Snap to grid: %s",
(docSettings->getSnapToGrid() ? "On": "Off"));
StatusBar::instance()->setStatusText(250, buf);
}
示例4: onExecute
void ScrollCommand::onExecute(Context* context)
{
IDocumentSettings* docSettings = context->getSettings()->getDocumentSettings(context->getActiveDocument());
ui::View* view = ui::View::getView(current_editor);
gfx::Rect vp = view->getViewportBounds();
gfx::Point scroll = view->getViewScroll();
gfx::Rect gridBounds = docSettings->getGridBounds();
int dx = 0;
int dy = 0;
int pixels = 0;
switch (m_units) {
case Pixel:
pixels = 1;
break;
case TileWidth:
pixels = gridBounds.w;
break;
case TileHeight:
pixels = gridBounds.h;
break;
case ZoomedPixel:
pixels = 1 << current_editor->getZoom();
break;
case ZoomedTileWidth:
pixels = gridBounds.w << current_editor->getZoom();
break;
case ZoomedTileHeight:
pixels = gridBounds.h << current_editor->getZoom();
break;
case ViewportWidth:
pixels = vp.h;
break;
case ViewportHeight:
pixels = vp.w;
break;
}
switch (m_direction) {
case Left: dx = -m_quantity * pixels; break;
case Right: dx = +m_quantity * pixels; break;
case Up: dy = -m_quantity * pixels; break;
case Down: dy = +m_quantity * pixels; break;
}
current_editor->setEditorScroll(scroll.x+dx, scroll.y+dy, true);
}
示例5: onExecute
void DespeckleCommand::onExecute(Context* context)
{
IDocumentSettings* docSettings = context->settings()->getDocumentSettings(context->activeDocument());
MedianFilter filter;
filter.setTiledMode(docSettings->getTiledMode());
filter.setSize(get_config_int(ConfigSection, "Width", 3),
get_config_int(ConfigSection, "Height", 3));
FilterManagerImpl filterMgr(context, &filter);
filterMgr.setTarget(TARGET_RED_CHANNEL |
TARGET_GREEN_CHANNEL |
TARGET_BLUE_CHANNEL |
TARGET_GRAY_CHANNEL);
DespeckleWindow window(filter, filterMgr);
if (window.doModal()) {
set_config_int(ConfigSection, "Width", filter.getWidth());
set_config_int(ConfigSection, "Height", filter.getHeight());
}
}
示例6: onExecute
void onExecute(Context* context)
{
IDocumentSettings* docSettings = context->getSettings()->getDocumentSettings(context->getActiveDocument());
docSettings->setGridVisible(docSettings->getGridVisible() ? false: true);
}
示例7: onChecked
bool onChecked(Context* context)
{
IDocumentSettings* docSettings = context->getSettings()->getDocumentSettings(context->getActiveDocument());
return docSettings->getGridVisible();
}
示例8: onExecute
void onExecute(Context* context)
{
IDocumentSettings* docSettings = context->getSettings()->getDocumentSettings(context->getActiveDocument());
docSettings->setUseOnionskin(docSettings->getUseOnionskin() ? false: true);
}
示例9: onChecked
bool onChecked(Context* context)
{
IDocumentSettings* docSettings = context->getSettings()->getDocumentSettings(context->getActiveDocument());
return docSettings->getUseOnionskin();
}
示例10: applied
/**
Draws the @a frame of animation of the specified @a sprite
in a new image and return it.
Positions source_x, source_y, width and height must have the
zoom applied (zoom.apply(sorce_x), zoom.apply(source_y), zoom.apply(width), etc.)
*/
Image* RenderEngine::renderSprite(int source_x, int source_y,
int width, int height,
FrameNumber frame, Zoom zoom,
bool draw_tiled_bg,
bool enable_onionskin,
ImageBufferPtr& buffer)
{
void (*zoomed_func)(Image*, const Image*, const Palette*, int, int, int, int, Zoom);
const LayerImage* background = m_sprite->backgroundLayer();
bool need_checked_bg = (background != NULL ? !background->isVisible(): true);
uint32_t bg_color = 0;
Image *image;
switch (m_sprite->pixelFormat()) {
case IMAGE_RGB:
zoomed_func = merge_zoomed_image<RgbTraits, RgbTraits>;
break;
case IMAGE_GRAYSCALE:
zoomed_func = merge_zoomed_image<RgbTraits, GrayscaleTraits>;
break;
case IMAGE_INDEXED:
zoomed_func = merge_zoomed_image<RgbTraits, IndexedTraits>;
if (!need_checked_bg)
bg_color = m_sprite->getPalette(frame)->getEntry(m_sprite->transparentColor());
break;
default:
return NULL;
}
// Create a temporary RGB bitmap to draw all to it
image = Image::create(IMAGE_RGB, width, height, buffer);
if (!image)
return NULL;
// Draw checked background
if (need_checked_bg && draw_tiled_bg)
renderCheckedBackground(image, source_x, source_y, zoom);
else
clear_image(image, bg_color);
// Draw the current frame.
global_opacity = 255;
renderLayer(m_sprite->folder(), image,
source_x, source_y, frame, zoom, zoomed_func, true, true, -1);
// Onion-skin feature: Draw previous/next frames with different
// opacity (<255) (it is the onion-skinning)
IDocumentSettings* docSettings = UIContext::instance()
->settings()->getDocumentSettings(m_document);
if (enable_onionskin & docSettings->getUseOnionskin()) {
int prevs = docSettings->getOnionskinPrevFrames();
int nexts = docSettings->getOnionskinNextFrames();
int opacity_base = docSettings->getOnionskinOpacityBase();
int opacity_step = docSettings->getOnionskinOpacityStep();
for (FrameNumber f=frame.previous(prevs); f <= frame.next(nexts); ++f) {
if (f == frame || f < 0 || f > m_sprite->lastFrame())
continue;
else if (f < frame)
global_opacity = opacity_base - opacity_step * ((frame - f)-1);
else
global_opacity = opacity_base - opacity_step * ((f - frame)-1);
if (global_opacity > 0) {
global_opacity = MID(0, global_opacity, 255);
int blend_mode = -1;
if (docSettings->getOnionskinType() == IDocumentSettings::Onionskin_Merge)
blend_mode = BLEND_MODE_NORMAL;
else if (docSettings->getOnionskinType() == IDocumentSettings::Onionskin_RedBlueTint)
blend_mode = (f < frame ? BLEND_MODE_RED_TINT: BLEND_MODE_BLUE_TINT);
renderLayer(m_sprite->folder(), image,
source_x, source_y, f, zoom, zoomed_func,
true, true, blend_mode);
}
}
}
return image;
}
示例11: window
void OptionsCommand::onExecute(Context* context)
{
// Load the window widget
UniquePtr<Window> window(app::load_widget<Window>("options.xml", "options"));
Widget* check_smooth = app::find_widget<Widget>(window, "smooth");
Widget* move_click2 = app::find_widget<Widget>(window, "move_click2");
Widget* draw_click2 = app::find_widget<Widget>(window, "draw_click2");
Widget* cursor_color_box = app::find_widget<Widget>(window, "cursor_color_box");
Widget* grid_color_box = app::find_widget<Widget>(window, "grid_color_box");
Widget* pixel_grid_color_box = app::find_widget<Widget>(window, "pixel_grid_color_box");
m_checked_bg = app::find_widget<ComboBox>(window, "checked_bg_size");
m_checked_bg_zoom = app::find_widget<Widget>(window, "checked_bg_zoom");
Widget* checked_bg_color1_box = app::find_widget<Widget>(window, "checked_bg_color1_box");
Widget* checked_bg_color2_box = app::find_widget<Widget>(window, "checked_bg_color2_box");
Button* checked_bg_reset = app::find_widget<Button>(window, "checked_bg_reset");
Widget* undo_size_limit = app::find_widget<Widget>(window, "undo_size_limit");
Widget* undo_goto_modified = app::find_widget<Widget>(window, "undo_goto_modified");
Widget* button_ok = app::find_widget<Widget>(window, "button_ok");
// Cursor color
ColorButton* cursor_color = new ColorButton(Editor::get_cursor_color(), IMAGE_RGB);
cursor_color->setId("cursor_color");
cursor_color_box->addChild(cursor_color);
// Get global settings for documents
IDocumentSettings* docSettings = context->getSettings()->getDocumentSettings(NULL);
// Grid color
ColorButton* grid_color = new ColorButton(docSettings->getGridColor(), IMAGE_RGB);
grid_color->setId("grid_color");
grid_color_box->addChild(grid_color);
// Pixel grid color
ColorButton* pixel_grid_color = new ColorButton(docSettings->getPixelGridColor(), IMAGE_RGB);
pixel_grid_color->setId("pixel_grid_color");
pixel_grid_color_box->addChild(pixel_grid_color);
// Others
if (get_config_bool("Options", "MoveClick2", false))
move_click2->setSelected(true);
if (get_config_bool("Options", "DrawClick2", false))
draw_click2->setSelected(true);
if (get_config_bool("Options", "MoveSmooth", true))
check_smooth->setSelected(true);
// Checked background size
m_checked_bg->addItem("16x16");
m_checked_bg->addItem("8x8");
m_checked_bg->addItem("4x4");
m_checked_bg->addItem("2x2");
m_checked_bg->setSelectedItem((int)RenderEngine::getCheckedBgType());
// Zoom checked background
if (RenderEngine::getCheckedBgZoom())
m_checked_bg_zoom->setSelected(true);
// Checked background colors
m_checked_bg_color1 = new ColorButton(RenderEngine::getCheckedBgColor1(), IMAGE_RGB);
m_checked_bg_color2 = new ColorButton(RenderEngine::getCheckedBgColor2(), IMAGE_RGB);
checked_bg_color1_box->addChild(m_checked_bg_color1);
checked_bg_color2_box->addChild(m_checked_bg_color2);
// Reset button
checked_bg_reset->Click.connect(Bind<void>(&OptionsCommand::onResetCheckedBg, this));
// Undo limit
undo_size_limit->setTextf("%d", get_config_int("Options", "UndoSizeLimit", 8));
// Goto modified frame/layer on undo/redo
if (get_config_bool("Options", "UndoGotoModified", true))
undo_goto_modified->setSelected(true);
// Show the window and wait the user to close it
window->openWindowInForeground();
if (window->getKiller() == button_ok) {
int undo_size_limit_value;
Editor::set_cursor_color(cursor_color->getColor());
docSettings->setGridColor(grid_color->getColor());
docSettings->setPixelGridColor(pixel_grid_color->getColor());
set_config_bool("Options", "MoveSmooth", check_smooth->isSelected());
set_config_bool("Options", "MoveClick2", move_click2->isSelected());
set_config_bool("Options", "DrawClick2", draw_click2->isSelected());
RenderEngine::setCheckedBgType((RenderEngine::CheckedBgType)m_checked_bg->getSelectedItem());
RenderEngine::setCheckedBgZoom(m_checked_bg_zoom->isSelected());
RenderEngine::setCheckedBgColor1(m_checked_bg_color1->getColor());
RenderEngine::setCheckedBgColor2(m_checked_bg_color2->getColor());
undo_size_limit_value = undo_size_limit->getTextInt();
undo_size_limit_value = MID(1, undo_size_limit_value, 9999);
set_config_int("Options", "UndoSizeLimit", undo_size_limit_value);
set_config_bool("Options", "UndoGotoModified", undo_goto_modified->isSelected());
// Save configuration
//.........这里部分代码省略.........
示例12: onChecked
bool onChecked(Context* context)
{
IDocumentSettings* docSettings = context->settings()->getDocumentSettings(context->activeDocument());
return docSettings->getSnapToGrid();
}