Schrift
[thread]4561[/thread]

editor in perl 0.3.n: hurra (Seite 53)

Leser: 4


<< |< 1 ... 50 51 52 53 54 55 56 ... 64 >| >> 631 Einträge, 64 Seiten
renee
 2007-11-09 14:52
#102122 #102122
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Für mich ich dieses Feature nicht mehr so wichtig, weil ich ne Lösung habe ;-)

Jetzt wäre es noch cool, die Konsole einzubauen *g*
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/
Antworten mit Zitat
lichtkind
 2007-11-09 16:28
#102128 #102128
User since
2004-03-22
5708 Artikel
ModeratorIn + EditorIn
[Homepage]
user image
darf ich fragen wie du es gelöst hast?
Wiki:Tutorien in der Wiki, mein zeug:
kephra, baumhaus, garten, gezwitscher

Es beginnt immer mit einer Entscheidung.
Antworten mit Zitat
renee
 2007-11-09 16:39
#102130 #102130
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Ein Kephra::Dialog::Template-Modul, in der commands.conf den Tastaturkürzel für den Dialog festgelegt, in der Dialog.pm eine Methode zum Start des Dialogs eingefügt...

Änderung in der Dialog.pm:
Code (perl): (dl )
1
2
3
4
sub templates{
   require Kephra::Dialog::Template;
   &Kephra::Dialog::Template::main;
}



Template.pm (Du wirst jetzt sicherlich die Hände über dem Kopf zusammenschlagen, aber ich kenne mich mit Wx nicht aus und musste so auf bestehende Dialoge zurückgreifen):
Code (perl): (dl )
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
109
110
111
112
package Kephra::Dialog::Template;
$VERSION = '0.17';

use strict;
use Wx qw( 
        wxVERTICAL wxHORIZONTAL wxLEFT wxTOP wxBOTTOM wxGROW wxEXPAND wxALIGN_CENTRE
        wxSYSTEM_MENU wxCAPTION wxSTAY_ON_TOP wxNO_FULL_REPAINT_ON_RESIZE
        wxSIMPLE_BORDER wxRAISED_BORDER  
        wxCLOSE_BOX wxMINIMIZE_BOX  wxFRAME_NO_TASKBAR  wxBITMAP_TYPE_XPM  wxWHITE
        wxTR_NO_BUTTONS wxTR_HIDE_ROOT wxTR_SINGLE
);

use Wx::Event
        qw(EVT_KEY_DOWN EVT_TEXT EVT_BUTTON EVT_CHECKBOX EVT_RADIOBUTTON EVT_CLOSE);
   
   
my $template_path = './templates/';

sub _get { $Kephra::app{dialog}{template} }
sub _set { $Kephra::app{dialog}{template} = $_[0] if ref $_[0] eq 'Wx::Frame' }

sub main {
        if ( !$Kephra::temp{dialog}{template}{active}
        or    $Kephra::temp{dialog}{template}{active} == 0 ) {

                # init search and replace dialog
                $Kephra::temp{dialog}{template}{active} = 1;
                my $frame  = Kephra::App::Window::_get();
                my $config = $Kephra::config{dialog}{template};
                my $d_l10n = $Kephra::localisation{dialog}{template};
                my $g_l10n = $Kephra::localisation{dialog}{general};
                #my $m_l10n = $Kephra::localisation{app}{menu};
                #my $cl_l10n= $Kephra::localisation{commandlist}{label};
                my $d_style= wxNO_FULL_REPAINT_ON_RESIZE | wxSYSTEM_MENU | wxCAPTION
                        | wxMINIMIZE_BOX | wxCLOSE_BOX | wxSTAY_ON_TOP;
                $d_style |= wxSTAY_ON_TOP if $Kephra::config{app}{window}{stay_on_top};

                # making window & main design
                my $dialog = Wx::Frame->new( $frame, -1, ' '.$d_l10n->{title},
                        [ $config->{position_x}, $config->{position_y} ], [ 120, 80 ],
                        $d_style);
                Kephra::App::Window::load_icon
                        ($dialog,Kephra::Config::dirpath($Kephra::config{app}{window}{icon}));
                _set($dialog);

                # main panel
                my $mpanel = Wx::Panel->new( $dialog, -1, [0, 0], [120, 160] );
                # construction left main menu
                my $input = Wx::TextCtrl->new( $mpanel, -1, '', 
                        [10, 4], [80, 20], wxSIMPLE_BORDER | wxRAISED_BORDER );


                # release
                $dialog->Show(1);
                Wx::Window::SetFocus( $input );

                EVT_CLOSE( $dialog, \&quit_template_dialog );
                EVT_KEY_DOWN($input, \&in_template );
                #EVT_TEXT_ENTER($input, \&in_template );

        } else {
                my $dialog = _get();
                $dialog->Iconize(0);
                $dialog->Raise;
        }
}

sub in_template{
   my ( $input, $event ) = @_;


   my $key_code = $event->GetKeyCode;
   if( $key_code == 13 ){
      my $statement = $input->GetValue;
      my @codes = split / /, $statement;
      
      if( @codes and $codes[0] eq 'i' ){
         shift @codes;
         my $ep = Kephra::App::EditPanel::_get();
         for my $tmpl ( @codes ){
            my $file = $template_path . $tmpl;
            my $text = Kephra::File::IO::open_buffer( $file );
            $ep->InsertText( $ep->GetCurrentPos, $text );
         }
      }
      elsif( @codes ){
         my $file = $template_path . $codes[0];
         if( -e $file ){
            Kephra::File::new_from_template( $file );
         }
      }
      $input->GetParent->GetParent->Close;
   }
   elsif( $key_code == 27 ){
      $input->GetParent->GetParent->Close;
   }
   
   $event->Skip;
}

sub quit_template_dialog {
        my ( $win, $event ) = @_;
        my $config = $Kephra::config{dialog}{template};
        if ( $config->{save_position} == 1 ) {
                ($config->{position_x}, $config->{position_y})
                        = $win->GetPositionXY;
        }
        $Kephra::temp{dialog}{template}{active} = 0;
        $win->Destroy;
}

1;


commands.conf:
Code: (dl )
1
2
3
4
5
6
7
8
9
...
new-template2 = Kephra::Dialog::templates()
...

<key>
<file>
new = ctrl+n
new-template2 = ctrl+y
...
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/
Antworten mit Zitat
renee
 2007-11-09 16:41
#102131 #102131
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Mit 'ESC' kann man den Dialog beenden...

Ich kann heute abend dann mal einen zwei-Minuten-Screencast machen, der zeigt, wie ich das einsetzen kann...

Achso, die File.pm hatte ich schon bei einem anderen Versuch ergänzt:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
sub new_from_template {
   my $template = shift;
        my $doc_nr = Kephra::Document::Internal::new_if_allowed('new');
        Kephra::Document::Internal::reset();
   
   return unless -e $template;
   
   my $panel = Kephra::App::EditPanel::_get();
   my $src   = Kephra::File::IO::open_buffer($template);
   $panel->SetText($src);
   
   my $doc_attr  = $Kephra::document{open}[$doc_nr];
   $doc_attr->{syntaxmode} = 'perl';
   
        Kephra::Document::_set_current_nr( $doc_nr );
}


Das kann man sicherlich noch in den Dialog mit einbauen.

Aber für mich funktioniert es einwandfrei...
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/
Antworten mit Zitat
lichtkind
 2007-11-09 18:21
#102141 #102141
User since
2004-03-22
5708 Artikel
ModeratorIn + EditorIn
[Homepage]
user image
ok das könnte man noch etwas optimieren aber so langsam versteh ich deinen ansatz. du willsteine neue datei mit template erstellen. meine idee war eher ein modul das sich rechts einblendet und verschiedene templates zu verschiedenen themen anbietet die mit einem klick eingefügt werden.

ich kann dir aber auch anbieten etwas zu programmieren, wo du deine templates in einem speziellen verzeichnis ablegst und ein verzeichnis im file menü hinzukommt wo automatisch alle templates angeboten werden.
Wiki:Tutorien in der Wiki, mein zeug:
kephra, baumhaus, garten, gezwitscher

Es beginnt immer mit einer Entscheidung.
Antworten mit Zitat
renee
 2007-11-09 19:38
#102146 #102146
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Das hat dann aber keine Eile, weil mir mein Ansatz erstmal langt... Mehr Komfort ist natürlich schön, aber das hier ist besser als nichts ;-)
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/
Antworten mit Zitat
lichtkind
 2007-11-09 19:52
#102150 #102150
User since
2004-03-22
5708 Artikel
ModeratorIn + EditorIn
[Homepage]
user image
die sache mit der file history hab ich auch an einem tag gemacht und wenn ich eh grad dabei, ist es weniger mehraufwand als vielleicht später.

ausserdem ist ja imemr noc die sache das mit dem nächsten update wieder mit dem standartcode wrestlen musst anstatt deine template datei einzukopieren.
Wiki:Tutorien in der Wiki, mein zeug:
kephra, baumhaus, garten, gezwitscher

Es beginnt immer mit einer Entscheidung.
Antworten mit Zitat
lichtkind
 2007-11-10 21:00
#102189 #102189
User since
2004-03-22
5708 Artikel
ModeratorIn + EditorIn
[Homepage]
user image
renee: ich hab jetzt angefangen das per zentraler template datei zu machen. der eintrag für das menü taucht bereits im hauptmenü aus ebenfall die funktion die templates direlt aus dem editor zu bearbeiten. (ist ja nur ne textdatei.)

Die templates haben bisher 3 eigenschaften.

* name = label des menüeintrages
* syntaxmode = higlighting das beim starteingesetzt wird
* content = kann über beliebige zeilen gehen musst nur mit einrückung aufpassen

fällt dir noch was ein ?

ich sag bescheid wenn fertig ist, hab heute wieder menge dreckigen stellen ausgemistet.
Wiki:Tutorien in der Wiki, mein zeug:
kephra, baumhaus, garten, gezwitscher

Es beginnt immer mit einer Entscheidung.
Antworten mit Zitat
lichtkind
 2007-11-11 00:00
#102190 #102190
User since
2004-03-22
5708 Artikel
ModeratorIn + EditorIn
[Homepage]
user image
0.3.4.11:

Komplettes Templatehandling wie besprochen, zusätzlich kann man einem template noch description beilegen, die in statuszeile erscheint wenn man über menüpunkt geht.

Ansonst hab ich sehr viel interna ufgeräumt, fehlerdialog repariert, sichtbarstes zeichen davon ist sicher das alle dateipfade mit File::Spec regularisiert sind.
Wiki:Tutorien in der Wiki, mein zeug:
kephra, baumhaus, garten, gezwitscher

Es beginnt immer mit einer Entscheidung.
Antworten mit Zitat
renee
 2007-11-14 15:11
#102406 #102406
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Was mir bei dem Template-Handling fehlt:

*) es wäre gut, wenn es über Tastenkombinationen erreichbar wäre
*) es ist relativ umständlich neue Templates zu erstellen. Bei meiner Lösung war es so, dass man einfach ein Snippet in den entsprechenden Ordner speichern musste
*) Templates können nicht an die aktuelle Cursor-Position eingefügt werden. Es werden immer neue Dokumente aufgemacht...
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/
Antworten mit Zitat
<< |< 1 ... 50 51 52 53 54 55 56 ... 64 >| >> 631 Einträge, 64 Seiten



View all threads created 2005-10-21 17:46.