editor/editor_layout.cpp

Go to the documentation of this file.
00001 /* $Id: editor_layout.cpp 53445 2012-03-05 14:27:07Z fendrin $ */
00002 /*
00003   Copyright (C) 2003 - 2012 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 as published by
00008   the Free Software Foundation; either version 2 of the License, or
00009    (at your option) any later version.
00010   This program is distributed in the hope that it will be useful,
00011   but WITHOUT ANY WARRANTY.
00012 
00013   See the COPYING file for more details.
00014 */
00015 
00016 #define GETTEXT_DOMAIN "wesnoth-editor"
00017 
00018 /**
00019  * @file
00020  * Set various sizes for the screen-layout of the map editor.
00021  */
00022 
00023 #include "display.hpp"
00024 #include "editor_layout.hpp"
00025 
00026 
00027 namespace {
00028     const size_t default_terrain_size = 36;
00029     const size_t default_terrain_width = 4;
00030     const size_t default_brush_width = 4;
00031 }
00032 
00033 namespace editor {
00034 
00035 size_specs::size_specs()
00036     : terrain_size(default_terrain_size)
00037     , terrain_padding(0)
00038     , terrain_space(0)
00039     , terrain_width(default_terrain_width)
00040     , palette_x(0)
00041     , palette_y(0)
00042     , palette_h(20)
00043     , palette_w(10)
00044     , brush_x(0)
00045     , brush_y(0)
00046     , brush_padding(1)
00047     , brush_width(default_brush_width)
00048 {
00049 }
00050 
00051 void adjust_sizes(const display &disp, size_specs &sizes) {
00052     /** @todo Hardcoded coordinates for brush selection, make them themeable. */
00053     sizes.brush_x = disp.map_outside_area().w + 12;
00054     sizes.brush_y = (disp.h() >= 768) ? 340 : 270;
00055     /** @todo Hardcoded coordinates for terrain palette, make them themeable. */
00056     sizes.palette_x = disp.map_outside_area().w + 12;
00057     sizes.palette_y = sizes.brush_y + 33;
00058     sizes.palette_w = sizes.terrain_space * sizes.terrain_width;
00059     sizes.palette_h = disp.h() - sizes.palette_y;
00060     sizes.terrain_padding = (disp.h() >= 768) ? 3 : 1;
00061     sizes.terrain_space = sizes.terrain_size + sizes.terrain_padding;
00062 }
00063 
00064 } // end namespace editor
00065 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Tue Mar 13 2012 01:02:39 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs