editor_layout.cpp

Go to the documentation of this file.
00001 /* $Id: editor_layout.cpp 25168 2008-03-26 18:38:50Z boucman $ */
00002 /*
00003   Copyright (C) 2003 - 2008 by David White <dave@whitevine.net>
00004   Part of the Battle for Wesnoth Project http://www.wesnoth.org/
00005 
00006   This program is free software; you can redistribute it and/or modify
00007   it under the terms of the GNU General Public License version 2
00008   or at your option any later version.
00009   This program is distributed in the hope that it will be useful,
00010   but WITHOUT ANY WARRANTY.
00011 
00012   See the COPYING file for more details.
00013 */
00014 
00015 //! @file editor/editor_layout.cpp 
00016 //! Set various sizes for the screen-layout of the map editor.
00017 
00018 #include "editor_layout.hpp"
00019 #include "util.hpp"
00020 
00021 
00022 namespace {
00023     const size_t default_terrain_size = 36;
00024     const size_t default_palette_width = 3;
00025 }
00026 
00027 namespace map_editor {
00028 
00029 size_specs::size_specs() {
00030     terrain_size = default_terrain_size;
00031     terrain_padding = 2;
00032     terrain_space = terrain_size + terrain_padding;
00033     terrain_width = default_palette_width;
00034     brush_x = 0;
00035     brush_y = 0;
00036     brush_padding = 5;
00037     palette_x = 0;
00038     palette_y = 0;
00039     palette_w = 10;
00040     palette_h = 20;
00041 }
00042 
00043 void adjust_sizes(const display &disp, size_specs &sizes) {
00044     //! @todo Hardcoded coordinates for brush selection, make it themeable
00045     sizes.brush_x = disp.map_outside_area().w + 22;
00046     sizes.brush_y = 165;
00047     //! @todo Hardcoded coordinates for terrain palette, make it themeable
00048     sizes.palette_x = disp.map_outside_area().w + 16;
00049     sizes.palette_y = sizes.brush_y + 132 + 10;
00050     sizes.palette_w = sizes.terrain_space * default_palette_width;
00051     //the '-5' make sure that the scroll down button can not be outside of
00052     //the window, this is probably a bug in placement anyway...
00053     sizes.palette_h = disp.h() - sizes.palette_y - 5;
00054 }
00055 
00056 } // end namespace map_editor
00057 

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs