more tycho stuff
parent
87bfe2869a
commit
789e3de93f
|
@ -1,6 +1,6 @@
|
|||
/target
|
||||
/out
|
||||
data/*.res
|
||||
*.res
|
||||
**/*.rs.bk
|
||||
Cargo.lock
|
||||
perf.data*
|
||||
|
|
|
@ -21,7 +21,7 @@ gio-sys = "0.8"
|
|||
glib = "0.7"
|
||||
glib-sys = "0.8"
|
||||
gobject-sys = "0.8"
|
||||
gtk = "0.6"
|
||||
gtk = {version = "0.6", features = ["v3_16"]}
|
||||
gtk-sys = "0.8"
|
||||
pango = "0.6"
|
||||
pango-sys = "0.8"
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
fn mk_btn_new(b: >k::Builder)
|
||||
{
|
||||
let btn: gtk::MenuItem = get_obj(b, "btn-new");
|
||||
let tools: gtk::Window = get_obj(b, "win-map-tools");
|
||||
let view: gtk::Window = get_obj(b, "win-map-view");
|
||||
|
||||
btn.connect_activate(move |_| {
|
||||
// TODO: actually make a new document
|
||||
tools.show_all();
|
||||
view.show_all();
|
||||
});
|
||||
}
|
||||
|
||||
fn mk_btn_quit(b: >k::Builder, app: gtk::Application)
|
||||
{
|
||||
let btn: gtk::MenuItem = get_obj(b, "btn-quit");
|
||||
|
||||
btn.connect_activate(move |_| app.quit());
|
||||
}
|
||||
|
||||
fn mk_btn_about(b: >k::Builder)
|
||||
{
|
||||
let btn: gtk::MenuItem = get_obj(b, "btn-about");
|
||||
let win: gtk::AboutDialog = get_obj(b, "win-about");
|
||||
|
||||
btn.connect_activate(move |_| {
|
||||
win.run();
|
||||
win.hide();
|
||||
});
|
||||
}
|
||||
|
||||
fn mk_btn_show_map_view(b: >k::Builder)
|
||||
{
|
||||
let btn: gtk::MenuItem = get_obj(b, "btn-show-map-view");
|
||||
let win: gtk::Window = get_obj(b, "win-map-view");
|
||||
|
||||
btn.connect_activate(move |_| win.show_all());
|
||||
}
|
||||
|
||||
fn mk_btn_show_map_tools(b: >k::Builder)
|
||||
{
|
||||
let btn: gtk::MenuItem = get_obj(b, "btn-show-map-tools");
|
||||
let win: gtk::Window = get_obj(b, "win-map-tools");
|
||||
|
||||
btn.connect_activate(move |_| win.show_all());
|
||||
}
|
||||
|
||||
// EOF
|
Binary file not shown.
|
@ -27,33 +27,75 @@ Author: Alison Sanderson
|
|||
|
||||
-->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.10"/>
|
||||
<requires lib="gtk+" version="3.16"/>
|
||||
<!-- interface-license-type mit -->
|
||||
<!-- interface-name Maraiah Tycho -->
|
||||
<!-- interface-description Tycho map editor for Maraiah. -->
|
||||
<!-- interface-copyright 2018-2019 Alison Sanderson -->
|
||||
<!-- interface-authors Alison Sanderson -->
|
||||
<object class="GtkImage" id="im_lines">
|
||||
<object class="GtkAdjustment" id="adj-map-horz">
|
||||
<property name="upper">100</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="adj-map-vert">
|
||||
<property name="upper">100</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkWindow" id="win-map-view">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="title" translatable="yes">Map View</property>
|
||||
<property name="default_width">600</property>
|
||||
<property name="default_height">400</property>
|
||||
<child type="titlebar">
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">always</property>
|
||||
<property name="vscrollbar_policy">always</property>
|
||||
<property name="window_placement">top-right</property>
|
||||
<property name="overlay_scrolling">False</property>
|
||||
<child>
|
||||
<object class="GtkViewport">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hadjustment">adj-map-horz</property>
|
||||
<property name="vadjustment">adj-map-vert</property>
|
||||
<child>
|
||||
<object class="GtkDrawingArea" id="draw-area">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkImage" id="img-lines">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="resource">/net/greyserv/maraiah/tycho/lines</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="im_points">
|
||||
<object class="GtkImage" id="img-points">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="resource">/net/greyserv/maraiah/tycho/points</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="im_polys">
|
||||
<object class="GtkImage" id="img-polys">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="resource">/net/greyserv/maraiah/tycho/polys</property>
|
||||
</object>
|
||||
<object class="GtkWindow" id="win_tools">
|
||||
<object class="GtkWindow" id="win-map-tools">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="title" translatable="yes">Tool Palette</property>
|
||||
<property name="default_height">250</property>
|
||||
<property name="skip_taskbar_hint">True</property>
|
||||
<property name="has_resize_grip">True</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
|
@ -68,14 +110,14 @@ Author: Alison Sanderson
|
|||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Geometry</property>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="btn_point">
|
||||
<object class="GtkToolButton" id="btn-point">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Points</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="icon_widget">im_points</property>
|
||||
<property name="icon_widget">img-points</property>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="btn_point-atkobject">
|
||||
<object class="AtkObject" id="btn-point-atkobject">
|
||||
<property name="AtkObject::accessible-name" translatable="yes">Points Tool</property>
|
||||
<property name="AtkObject::accessible-description" translatable="yes">The tool that modifies points in the map.</property>
|
||||
<property name="AtkObject::accessible-role" translatable="yes">push-button</property>
|
||||
|
@ -87,14 +129,14 @@ Author: Alison Sanderson
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="btn_lines">
|
||||
<object class="GtkToolButton" id="btn-lines">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Lines</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="icon_widget">im_lines</property>
|
||||
<property name="icon_widget">img-lines</property>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="btn_lines-atkobject">
|
||||
<object class="AtkObject" id="btn-lines-atkobject">
|
||||
<property name="AtkObject::accessible-name" translatable="yes">Lines Tool</property>
|
||||
<property name="AtkObject::accessible-description" translatable="yes">The tool which modifies line segments on the map.</property>
|
||||
<property name="AtkObject::accessible-role" translatable="yes">push-button</property>
|
||||
|
@ -107,14 +149,14 @@ Author: Alison Sanderson
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="btn_polys">
|
||||
<object class="GtkToolButton" id="btn-polys">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Polygons</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="icon_widget">im_polys</property>
|
||||
<property name="icon_widget">img-polys</property>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="btn_polys-atkobject">
|
||||
<object class="AtkObject" id="btn-polys-atkobject">
|
||||
<property name="AtkObject::accessible-name" translatable="yes">Polygon Tool</property>
|
||||
<property name="AtkObject::accessible-description" translatable="yes">The tool which modifies polygon shapes on the map.</property>
|
||||
<property name="AtkObject::accessible-role" translatable="yes">push-button</property>
|
||||
|
@ -141,17 +183,16 @@ Author: Alison Sanderson
|
|||
</object>
|
||||
</child>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="win_tools-atkobject">
|
||||
<object class="AtkObject" id="win-map-tools-atkobject">
|
||||
<property name="AtkObject::accessible-name" translatable="yes">Tycho Tool Palette</property>
|
||||
<property name="AtkObject::accessible-description" translatable="yes">Tycho's tool palette window.</property>
|
||||
<property name="AtkObject::accessible-role" translatable="yes">window</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkAboutDialog" id="win_about">
|
||||
<object class="GtkAboutDialog" id="win-about">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="modal">True</property>
|
||||
<property name="destroy_with_parent">True</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<property name="program_name">Tycho Map Editor</property>
|
||||
<property name="copyright" translatable="yes">Copyright © 2018-2019 Alison Sanderson</property>
|
||||
|
@ -184,18 +225,19 @@ Author: Alison Sanderson
|
|||
</object>
|
||||
</child>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="win_about-atkobject">
|
||||
<object class="AtkObject" id="win-about-atkobject">
|
||||
<property name="AtkObject::accessible-name" translatable="yes">About Screen</property>
|
||||
<property name="AtkObject::accessible-description" translatable="yes">The about screen for Tycho.</property>
|
||||
<property name="AtkObject::accessible-role" translatable="yes">dialog</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkWindow" id="win_menus">
|
||||
<object class="GtkWindow" id="win-main">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="title" translatable="yes">Tycho</property>
|
||||
<property name="resizable">False</property>
|
||||
<property name="default_width">120</property>
|
||||
<property name="default_height">250</property>
|
||||
<property name="has_resize_grip">True</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
|
@ -215,39 +257,30 @@ Author: Alison Sanderson
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem">
|
||||
<property name="label">gtk-new</property>
|
||||
<object class="GtkMenuItem" id="btn-new">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Create a new project.</property>
|
||||
<property name="label" translatable="yes">_New Project</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem">
|
||||
<property name="label">gtk-open</property>
|
||||
<object class="GtkMenuItem" id="btn-open">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Opens any type of project file.</property>
|
||||
<property name="label" translatable="yes">_Open</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem">
|
||||
<property name="label">gtk-save</property>
|
||||
<object class="GtkMenuItem" id="btn-save">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Saves the currently open project.</property>
|
||||
<property name="label" translatable="yes">_Save</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem">
|
||||
<property name="label">gtk-save-as</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -257,62 +290,12 @@ Author: Alison Sanderson
|
|||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem">
|
||||
<property name="label">gtk-quit</property>
|
||||
<object class="GtkMenuItem" id="btn-quit">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Quit the application.</property>
|
||||
<property name="label" translatable="yes">_Quit</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">_Edit</property>
|
||||
<property name="use_underline">True</property>
|
||||
<child type="submenu">
|
||||
<object class="GtkMenu">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem">
|
||||
<property name="label">gtk-cut</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem">
|
||||
<property name="label">gtk-copy</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem">
|
||||
<property name="label">gtk-paste</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem">
|
||||
<property name="label">gtk-delete</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@ -325,6 +308,30 @@ Author: Alison Sanderson
|
|||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">_View</property>
|
||||
<property name="use_underline">True</property>
|
||||
<child type="submenu">
|
||||
<object class="GtkMenu">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="btn-show-map-view">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Opens the map view window.</property>
|
||||
<property name="label" translatable="yes">Show _Map View</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="btn-show-map-tools">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Opens the map toolbox window.</property>
|
||||
<property name="label" translatable="yes">Show Map _Tools</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -345,12 +352,12 @@ Author: Alison Sanderson
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="btn_about">
|
||||
<property name="label">gtk-about</property>
|
||||
<object class="GtkMenuItem" id="btn-about">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Opens a window with information about this program.</property>
|
||||
<property name="label" translatable="yes">_About</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
@ -1,53 +1,38 @@
|
|||
use gtk::prelude::*;
|
||||
use gdk::prelude::*;
|
||||
use gio::prelude::*;
|
||||
use gtk::prelude::*;
|
||||
use maraiah::durandal::err::*;
|
||||
|
||||
fn run_app(app: >k::Application) -> ResultS<()>
|
||||
{
|
||||
fn load_img(path: &'static str) -> ResultS<gdk_pixbuf::Pixbuf>
|
||||
{
|
||||
Ok(gdk_pixbuf::Pixbuf::new_from_resource(path)?)
|
||||
}
|
||||
include!("windows.rs");
|
||||
include!("buttons.rs");
|
||||
include!("map_draw.rs");
|
||||
|
||||
fn get_obj<T>(b: >k::Builder, name: &str) -> ResultS<T>
|
||||
where T: glib::object::IsA<glib::object::Object>
|
||||
fn run_app(app: >k::Application)
|
||||
{
|
||||
match b.get_object(name) {
|
||||
Some(w) => Ok(w),
|
||||
None => Err(err_msg("no object")),
|
||||
}
|
||||
}
|
||||
|
||||
// one fallible call, which should never fail anyhow
|
||||
let b = gtk::Builder::new_from_resource("/net/greyserv/maraiah/tycho/ui");
|
||||
|
||||
let win_menus: gtk::Window = get_obj(&b, "win_menus")?;
|
||||
let win_tools: gtk::Window = get_obj(&b, "win_tools")?;
|
||||
let win_about: gtk::AboutDialog = get_obj(&b, "win_about")?;
|
||||
let btn_about: gtk::MenuItem = get_obj(&b, "btn_about")?;
|
||||
//t draw_area: gtk::DrawingArea = get_obj(&b, "draw_area")?;
|
||||
//t btn_point: gtk::ToolButton = get_obj(&b, "btn_point")?;
|
||||
//t btn_lines: gtk::ToolButton = get_obj(&b, "btn_lines")?;
|
||||
//t btn_polys: gtk::ToolButton = get_obj(&b, "btn_polys")?;
|
||||
mk_btn_new(&b);
|
||||
mk_btn_quit(&b, app.clone());
|
||||
mk_btn_about(&b);
|
||||
mk_btn_show_map_view(&b);
|
||||
mk_btn_show_map_tools(&b);
|
||||
mk_draw_area(&b);
|
||||
mk_win_map_tools(&b);
|
||||
mk_win_map_view(&b);
|
||||
mk_win_about(&b);
|
||||
mk_win_main(&b, app);
|
||||
}
|
||||
|
||||
let authors: Vec<_> = env!("CARGO_PKG_AUTHORS").split(';').collect();
|
||||
fn load_img(path: &'static str) -> gdk_pixbuf::Pixbuf
|
||||
{
|
||||
gdk_pixbuf::Pixbuf::new_from_resource(path).unwrap()
|
||||
}
|
||||
|
||||
win_about.set_authors(&authors);
|
||||
win_about.set_version(env!("CARGO_PKG_VERSION"));
|
||||
win_about.set_website(env!("CARGO_PKG_HOMEPAGE"));
|
||||
win_about.set_logo(&load_img("/net/greyserv/maraiah/tycho/tycho2")?);
|
||||
|
||||
btn_about.connect_activate(move |_| {
|
||||
win_about.run();
|
||||
win_about.hide();
|
||||
});
|
||||
|
||||
win_tools.set_deletable(false);
|
||||
win_tools.show_all();
|
||||
|
||||
win_menus.set_application(app);
|
||||
win_menus.show_all();
|
||||
|
||||
Ok(())
|
||||
fn get_obj<T>(b: >k::Builder, name: &str) -> T
|
||||
where T: glib::object::IsA<glib::object::Object>
|
||||
{
|
||||
b.get_object(name).unwrap()
|
||||
}
|
||||
|
||||
fn main() -> ResultS<()>
|
||||
|
@ -69,21 +54,7 @@ fn main() -> ResultS<()>
|
|||
let app = gtk::Application::new("net.greyserv.maraiah.tycho",
|
||||
gio::ApplicationFlags::empty())?;
|
||||
|
||||
app.connect_activate(|app| {
|
||||
match run_app(app) {
|
||||
Ok(()) => (),
|
||||
Err(e) => {
|
||||
// print out an error if init failed somehow, otherwise the main
|
||||
// loop will proceed as normal (this is just to prevent panics in
|
||||
// weird circumstances such as breaking the builder while devving)
|
||||
gtk::MessageDialog::new(None::<>k::Window>,
|
||||
gtk::DialogFlags::empty(),
|
||||
gtk::MessageType::Error,
|
||||
gtk::ButtonsType::Ok,
|
||||
&format!("{:?}", e)).run();
|
||||
}
|
||||
}
|
||||
});
|
||||
app.connect_activate(run_app);
|
||||
|
||||
let ret = if app.run(&[]) == 0 {
|
||||
Ok(())
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
fn draw_clear(cr: &cairo::Context, w: f64, h: f64)
|
||||
{
|
||||
use cairo::{FontSlant, FontWeight};
|
||||
|
||||
// set up for text
|
||||
cr.select_font_face("Sans", FontSlant::Normal, FontWeight::Normal);
|
||||
cr.set_font_size(14.0);
|
||||
|
||||
// clear view
|
||||
cr.set_source_rgb(0.0, 0.0, 0.0);
|
||||
cr.rectangle(0.0, 0.0, w, h);
|
||||
cr.fill();
|
||||
}
|
||||
|
||||
fn draw_map_none(cr: &cairo::Context, im: &gdk_pixbuf::Pixbuf, w: f64, h: f64)
|
||||
{
|
||||
let im_w = f64::from(im.get_width());
|
||||
let im_h = f64::from(im.get_height());
|
||||
|
||||
// draw middle image
|
||||
cr.set_source_pixbuf(im, w / 2.0 - im_w / 2.0, h / 2.0 - im_h / 2.0);
|
||||
cr.paint();
|
||||
|
||||
// draw top border (these are separate so the bottom draws over the top)
|
||||
cr.set_source_rgb(0.28, 0.0, 0.0);
|
||||
cr.rectangle(0.0, 0.0, w, 18.0);
|
||||
cr.fill();
|
||||
|
||||
// draw top text
|
||||
cr.set_source_rgb(1.0, 0.0, 0.0);
|
||||
cr.move_to(4.0, 14.0);
|
||||
cr.show_text("Map Required To Proceed");
|
||||
|
||||
// draw bottom border
|
||||
cr.set_source_rgb(0.28, 0.0, 0.0);
|
||||
cr.rectangle(0.0, h - 18.0, w, h);
|
||||
cr.fill();
|
||||
|
||||
// draw bottom text
|
||||
cr.set_source_rgb(1.0, 0.0, 0.0);
|
||||
cr.move_to(4.0, h - 4.0);
|
||||
cr.show_text("CAS.qterm//CyberAcme Systems Inc.");
|
||||
}
|
||||
|
||||
fn mk_draw_area(b: >k::Builder)
|
||||
{
|
||||
let area: gtk::DrawingArea = get_obj(b, "draw-area");
|
||||
|
||||
let ax: gtk::Adjustment = get_obj(b, "adj-map-horz");
|
||||
let ay: gtk::Adjustment = get_obj(b, "adj-map-vert");
|
||||
|
||||
let im = load_img("/net/greyserv/maraiah/tycho/tycho1");
|
||||
|
||||
area.connect_draw(move |area, cr| {
|
||||
let w = f64::from(area.get_allocated_width());
|
||||
let h = f64::from(area.get_allocated_height());
|
||||
|
||||
ax.set_lower(0.0);
|
||||
ax.set_upper(w);
|
||||
|
||||
ay.set_lower(0.0);
|
||||
ay.set_upper(h);
|
||||
|
||||
draw_clear(&cr, w, h);
|
||||
draw_map_none(&cr, &im, w, h);
|
||||
|
||||
Inhibit(true)
|
||||
});
|
||||
}
|
||||
|
||||
// EOF
|
|
@ -0,0 +1,39 @@
|
|||
fn hide_on_delete(win: >k::Window, _: &gdk::Event) -> Inhibit
|
||||
{
|
||||
win.hide();
|
||||
Inhibit(true)
|
||||
}
|
||||
|
||||
fn mk_win_map_tools(b: >k::Builder)
|
||||
{
|
||||
let win: gtk::Window = get_obj(b, "win-map-tools");
|
||||
|
||||
win.connect_delete_event(hide_on_delete);
|
||||
}
|
||||
|
||||
fn mk_win_map_view(b: >k::Builder)
|
||||
{
|
||||
let win: gtk::Window = get_obj(b, "win-map-view");
|
||||
|
||||
win.connect_delete_event(hide_on_delete);
|
||||
}
|
||||
|
||||
fn mk_win_about(b: >k::Builder)
|
||||
{
|
||||
let win: gtk::AboutDialog = get_obj(b, "win-about");
|
||||
|
||||
win.set_authors(&env!("CARGO_PKG_AUTHORS").split(';').collect::<Vec<_>>());
|
||||
win.set_version(env!("CARGO_PKG_VERSION"));
|
||||
win.set_website(env!("CARGO_PKG_HOMEPAGE"));
|
||||
win.set_logo(&load_img("/net/greyserv/maraiah/tycho/tycho2"));
|
||||
}
|
||||
|
||||
fn mk_win_main(b: >k::Builder, app: >k::Application)
|
||||
{
|
||||
let win: gtk::Window = get_obj(b, "win-main");
|
||||
|
||||
win.set_application(app);
|
||||
win.show_all();
|
||||
}
|
||||
|
||||
// EOF
|
Loading…
Reference in New Issue