#!/opt/bin/perl =head1 NAME gce - gtk (perl) crossfire editor =cut our $VERSION='0.1'; use Gtk2 -init; use Crossfire; use Crossfire::Tilecache; our $VARDIR = "$ENV{HOME}/.gcfedit"; mkdir $VARDIR; our $PICKDIR = "$Crossfire::LIB/maps/editor/picks"; our $CFG; use GCE::MainWindow; use Data::Dumper; read_cfg ($VARDIR . '/config'); my $w = GCE::MainWindow->new; $w->load_layout; $w->show_all; Gtk2->main; sub read_cfg { my ($file) = @_; open CFG, $file or return; $CFG = eval join '', ; close CFG; } sub write_cfg { my ($file) = @_; open CFG, ">$file" or return; { local $Data::Dumper::Purity = 1; print CFG Data::Dumper->Dump ([$CFG], [qw/CFG/]); } close CFG; } # following 2 functions are taken from CV :) sub find_rcfile($) { my $path; for (@INC) { $path = "$_/GCE/$_[0]"; return $path if -r $path; } die "FATAL: can't find required file $_[0]\n"; } sub require_image($) { new_from_file Gtk2::Gdk::Pixbuf find_rcfile "images/$_[0]"; } sub get_pos_and_size { my ($window) = @_; my ($x, $y) = $window->get_position; my ($w, $h) = $window->get_size; return [$x, $y, $w, $h]; } sub set_pos_and_size { my ($window, $p_and_s) = @_; $window->set_default_size ($p_and_s->[2], $p_and_s->[3]); # FIXME: This sucks, moving it after showing it can't be a good thing. $window->show_all; $window->move ($p_and_s->[0], $p_and_s->[1]); } =head1 AUTHOR Marc Lehmann http://home.schmorp.de/ Robin Redeker http://www.ta-sa.org/ =cut