![]() |
|< 1 ... 23 24 25 26 27 28 29 ... 54 >| | ![]() |
539 Einträge, 54 Seiten |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
package Kephra::Dialog::Template; our $VERSION = 0.01; use strict; use warnings; use Wx qw( wxVERTICAL wxHORIZONTAL wxLEFT wxRIGHT wxTOP wxALL wxBOTTOM wxGROW wxEXPAND wxALIGN_RIGHT wxSYSTEM_MENU wxCAPTION wxSTAY_ON_TOP wxNO_FULL_REPAINT_ON_RESIZE wxCLOSE_BOX wxMINIMIZE_BOX wxFRAME_NO_TASKBAR wxBITMAP_TYPE_XPM wxWHITE wxTR_NO_BUTTONS wxTR_HIDE_ROOT wxTR_SINGLE ); use Wx::Event qw( EVT_BUTTON EVT_LISTBOX EVT_LISTBOX_DCLICK EVT_CLOSE); my $TEMPLATE = ""; sub _ref { if (ref $_[0] eq 'Wx::Dialog'){ $Kephra::app{dialog}{config} = $_[0] } else { $Kephra::app{dialog}{config} } } sub template_dialog { my $frame = Kephra::App::Window::_ref(); my $g_l10n = $Kephra::localisation{dialog}{general}; $TEMPLATE = ""; # making window & main design my $d = Wx::Dialog->new( $frame, -1, ' Templates', [ 0,0 ], [ 470, 560 ], ); my ($panel); my $list = Wx::ListBox->new( $d, -1 ); my $counter = 0; for my $name ( _list() ){ $list->Append( $name ); $list->SetClientData( $counter++, $name ); } EVT_LISTBOX( $list, $list, \&onselected ); EVT_LISTBOX_DCLICK( $list, $list, sub{ &onselected; $d->Close } ); # button line $d->{apply_button} = Wx::Button->new ( $d, -1, $g_l10n->{apply} ); $d->{cancel_button} = Wx::Button->new( $d, -1, $g_l10n->{cancel}); EVT_BUTTON( $d, $d->{apply_button}, sub {shift->Close} ); EVT_BUTTON( $d, $d->{cancel_button},sub {shift->Close} ); my $button_sizer = Wx::BoxSizer->new(wxHORIZONTAL); $button_sizer->Add( $d->{apply_button}, 0, wxRIGHT, 14 ); $button_sizer->Add( $d->{cancel_button}, 0, wxRIGHT, 22 ); # assembling lines my $d_sizer = Wx::BoxSizer->new(wxVERTICAL); $d_sizer->Add( $list, 1, wxEXPAND|wxALL, 14); $d_sizer->Add( $button_sizer, 0, wxBOTTOM|wxALIGN_RIGHT, 12); # release $d->SetSizer($d_sizer); $d->SetAutoLayout(1); $d->ShowModal; Wx::Window::SetFocus( $d->{cancel_button} ); EVT_CLOSE( $d, \&quit_config_dialog ); $TEMPLATE; } sub onselected { my ($list,$event) = @_; my $new = ""; unless( $event->GetInt() == -1 ) { $new = $event->GetString; } $TEMPLATE = $new; } sub _list { my @list; my $cfg = $Kephra::config{file}{templates}; my $file = Kephra::Config::filepath($cfg->{directory}, $cfg->{file}); my $tmp = Kephra::Config::File::load( $file ); if (exists $tmp->{template}){ $tmp = Kephra::Config::Tree::_convert_node_2_AoH(\$tmp->{template}); for my $template ( @{$tmp} ) { push @list, $template->{name}; } } @list; } sub quit_config_dialog { my ( $win, $event ) = @_; $win->Destroy; } 1;
1 2 3 4
sub get_template { require Kephra::Dialog::Template; &Kephra::Dialog::Template::template_dialog; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
sub new_from_template { my $template_name = Kephra::Dialog::get_template(); warn $template_name; return unless $template_name; Kephra::File->new(); my $cfg = $Kephra::config{file}{templates}; my $file = Kephra::Config::filepath($cfg->{directory}, $cfg->{file}); my $tmp = Kephra::Config::File::load( $file ); if (exists $tmp->{template}){ $tmp = Kephra::Config::Tree::_convert_node_2_AoH(\$tmp->{template}); my $untitled = $Kephra::localisation{app}{general}{untitled}; for my $template ( @{$tmp} ) { next unless $template_name eq $template->{name}; my $filepath = Kephra::Document::get_file_path() || "<$untitled>"; my $filename = Kephra::Document::file_name() || "<$untitled>"; my $firstname = Kephra::Document::first_name() || "<$untitled>"; my $content = $template->{content}; $content =~ s/\[\$\$firstname\]/$firstname/g; $content =~ s/\[\$\$filename\]/$filename/g; $content =~ s/\[\$\$filepath\]/$filepath/g; Kephra::Edit::insert_text($content); last; } } }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
C:\Kephra_4\Kephra\config\interface>C:\Programme\Gnu\bin\diff.exe -u commands.conf.bak commands.conf
--- commands.conf.bak 2008-12-08 10:49:38.000000000 +0100
+++ commands.conf 2008-12-08 10:50:36.000000000 +0100
@@ -6,6 +6,7 @@
</app>
<file>
new = Kephra::File::new()
+ new-from-template = Kephra::File::new_from_template()
open = Kephra::File::open()
open-dir = Kephra::File::open_all_of_dir()
reload = Kephra::File::reload_current()
@@ -741,6 +742,7 @@
app-exit = alt+f4
<file>
new = ctrl+n
+ new-from-template = ctrl+shift+n
open = ctrl+o
reload = ctrl+shift+o
reload-all = ctrl+alt+o
1
2
3
4
5
6
7
8
9
10
11
C:\Kephra_4\Kephra\config\interface>C:\Programme\Gnu\bin\diff.exe -u mainmenu.yml.bak mainmenu.yml
--- mainmenu.yml.bak 2008-12-08 10:51:10.000000000 +0100
+++ mainmenu.yml 2008-12-08 10:51:24.000000000 +0100
@@ -3,6 +3,7 @@
-
menu file:
- item file-new
+ - item file-new-from-template
-
menu file_open:
- item file-open
lichtkind+2008-12-08 12:49:19--noch nichtund falls du's nicht gesehen hast, hab die roadmap nochmal leicht geändert.
Quote++0.4.1 wird dazu da sein die syntax modes einzubauen, das noch ne menge cruft wegkommt, commentieren endlich sprachspezifisch wird, PERLTIDY! und vor allem das bei F5 der interpreter aufgerufen wird der auch die ganzen module kennt und nicht das lokale Kephra - perl.
![]() |
|< 1 ... 23 24 25 26 27 28 29 ... 54 >| | ![]() |
539 Einträge, 54 Seiten |