FORUM DE DISCUSSION SUR LE LANGAGE PANORAMIC
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.
FORUM DE DISCUSSION SUR LE LANGAGE PANORAMIC

Développement d'applications avec le langage Panoramic
 
AccueilAccueil  RechercherRechercher  Dernières imagesDernières images  S'enregistrerS'enregistrer  MembresMembres  Connexion  
Derniers sujets
» PANORAMIC V 1
Outil de génération d'une structure Panoramic valide Emptypar papydall Aujourd'hui à 3:22

» select intégrés [résolu]
Outil de génération d'une structure Panoramic valide Emptypar jjn4 Hier à 17:00

» number_mouse_up
Outil de génération d'une structure Panoramic valide Emptypar jjn4 Hier à 11:59

» Aide de PANORAMIC
Outil de génération d'une structure Panoramic valide Emptypar jjn4 Hier à 11:16

» trop de fichiers en cours
Outil de génération d'une structure Panoramic valide Emptypar lepetitmarocain Hier à 10:43

» Je teste PANORAMIC V 1 beta 1
Outil de génération d'une structure Panoramic valide Emptypar papydall Hier à 4:17

» bouton dans autre form que 0
Outil de génération d'une structure Panoramic valide Emptypar leclode Lun 6 Mai 2024 - 13:59

» KGF_dll - nouvelles versions
Outil de génération d'une structure Panoramic valide Emptypar Klaus Lun 6 Mai 2024 - 11:41

» Gestion d'un système client-serveur.
Outil de génération d'une structure Panoramic valide Emptypar Klaus Lun 6 Mai 2024 - 10:23

» Editeur EliP 6 : Le Tiny éditeur avec 25 onglets de travail
Outil de génération d'une structure Panoramic valide Emptypar Froggy One Jeu 2 Mai 2024 - 11:16

» @Jack
Outil de génération d'une structure Panoramic valide Emptypar Jack Mar 30 Avr 2024 - 20:40

» Une calculatrice en une ligne de programme
Outil de génération d'une structure Panoramic valide Emptypar jean_debord Dim 28 Avr 2024 - 8:47

» Form(résolu)
Outil de génération d'une structure Panoramic valide Emptypar leclode Sam 27 Avr 2024 - 17:59

» Bataille navale SM
Outil de génération d'une structure Panoramic valide Emptypar jjn4 Ven 26 Avr 2024 - 17:39

» Les maths du crocodile
Outil de génération d'une structure Panoramic valide Emptypar jean_debord Jeu 25 Avr 2024 - 10:37

Navigation
 Portail
 Index
 Membres
 Profil
 FAQ
 Rechercher
Rechercher
 
 

Résultats par :
 
Rechercher Recherche avancée
Mai 2024
LunMarMerJeuVenSamDim
  12345
6789101112
13141516171819
20212223242526
2728293031  
CalendrierCalendrier
Le Deal du moment : -20%
-20% Récupérateur à eau mural 300 ...
Voir le deal
79 €

 

 Outil de génération d'une structure Panoramic valide

Aller en bas 
2 participants
AuteurMessage
Klaus

Klaus


Nombre de messages : 12294
Age : 74
Localisation : Ile de France
Date d'inscription : 29/12/2009

Outil de génération d'une structure Panoramic valide Empty
MessageSujet: Outil de génération d'une structure Panoramic valide   Outil de génération d'une structure Panoramic valide EmptySam 15 Jan 2011 - 1:11

Suite aux multiples discussions sur la structure qu'un programme Panoramic devrait avoir, j'ai fait un petit utilitaire permettant de créer une telle structure qu'on peut ensuite étendre à volonté. On peut saisir 5 types d'information:
1. la liste des commandes LABEL spécifiques (hors routines évènements et hors sous-programmes internes)
2. la liste des commandes DIM
3. les commandes d'initialisation (interface graphique, initialisation de variables, ...)
4. la liste des routines évènements
5. la liste des sous-programmes internes

Pour les points 4 et 5, un bouton + permet d'ajouter une nouvelle routine. Le nom apparaît alors dans la combo, et le mémo en-dessous contient le squelette valide. On peut modifier ou étendre ce squelette. On peut ajouter autant de routines qu'un veut. On peut sélectionner une routine dans la combo et modifier son code.

Les boutons >>> permettent d'avoir une version visuellement plus grande qui affiche alors un bouton <<< qui revient à la visualisation normale.

Dans la partie gauche, un bouton Save permet de sauvegarder le projet. Il sera écrit dans un fichier *.bas et peut être repris tel quel par l'éditeur Panoramic pour tests ou pour modification/extension. Le bouton Load permet de recharger un tel projet sauvegardé, afin de le remodifier avec l'outil.

J'ai appelé mon programme Designer.bas, et je suggère de l'enregistrer dans un fichier source de ce nom. Voici le source:
Code:


label mod_start_label, mod_start_dim, mod_start_code
label mod_start_label_restore, mod_start_dim_restore, mod_start_code_restore
label mod_event_code, mod_subroutine_code
label mod_event_code_restore, mod_subroutine_code_restore
label add_event_code, add_subroutine_code, save_event, save_subroutine
label save_event_1, save_subroutine_1
label change_event, change_subroutine
label load_project, save_project, exit, reset, load_invalid

dim i%, j%, k%, n%, s$, s1$, xtop%, xleft%, nom$, crlf$, bas$, id_string$
dim type$, type%, flag_start_exists%, element_number%
dim event_noms$(300), event_codes$(300), event_modif%
dim subroutine_noms$(300), subroutine_codes$(300), subroutine_modif%

width 0,1200 : height 0,800

container 10 : top 10,40 : left 10,10 : caption 10,"Functions" : height 10,500 : width 10,200
button 11 : parent 11,10 : top 11,20 : left 11,10 : caption 11,"Load" : on_click 11,load_project
button 12 : parent 12,10 : top 12,50 : left 12,10 : caption 12,"Save" : on_click 12,save_project
button 14 : parent 14,10 : top 14,110 : left 14,10 : caption 14,"Exit" : on_click 14,exit

open_dialog 17 : filter 17,"Projets Designer|*.bas"
save_dialog 18 : filter 18,"Projets Designer|*.bas"

picture 20 : top 20,40 : left 20,250 : width 20,900 : height 20,700
2d_target_is 20 : 2d_rectangle 5,5,895,695
print_target_is 20 : print_locate 10,0 : print "Program"

picture 30 : top 30,60 : left 30,260 : width 30,300 : height 30,300
2d_target_is 30 : color 30,185,244,244 : 2d_fill_color 185,244,244
2d_rectangle 5,5,295,295
print_target_is 30 : print_locate 10,0  : print "Application_Start"
container 31 : top 31,80 : left 31,270 : caption 31,"Labels" : height 31,80 : width 31,280
container 32 : top 32,170 : left 32,270 : caption 32,"Dims" : height 32,80 : width 32,280
container 33 : top 33,260 : left 33,270 : caption 33,"Code" : height 33,80 : width 33,280
memo 34 : parent 34,31 : top 34,15 : left 34,10 : height 34,55 : width 34,220
memo 35 : parent 35,32 : top 35,15 : left 35,10 : height 35,55 : width 35,220
memo 36 : parent 36,33 : top 36,15 : left 36,10 : height 36,55 : width 36,220
button 37 : parent 37,31 : top 37,15 : left 37,240 : width 37,20 : caption 37,">>>" : on_click 37,mod_start_label
button 38 : parent 38,32 : top 38,15 : left 38,240 : width 38,20 : caption 38,">>>" : on_click 38,mod_start_dim
button 39 : parent 39,33 : top 39,15 : left 39,240 : width 39,20 : caption 39,">>>" : on_click 39,mod_start_code

container 40 : top 40,400 : left 40,260 : width 40,430 : height 40,300 : caption 40,"Events"
combo 41 : parent 41,40 : top 41,20 : left 41,10 : width 41,360  : on_change 41,change_event
memo 42 : parent 42,40 : top 42,50 : left 42,10 : width 42,360 : height 42,240
button 43 : parent 43,40 : top 43,170 : left 43,390 : width 43,20 : caption 43,">>>" : on_click 43,mod_event_code
button 44 : parent 44,40 : top 44,20 : left 44,390 : width 44,20 : caption 44,"+" : on_click 44,add_event_code

container 50 : top 50,400 : left 50,700 : width 50,430 : height 50,300 : caption 50,"Subroutines"
combo 51 : parent 51,50 : top 51,20 : left 51,10 : width 51,360 : on_change 51,change_subroutine
memo 52 : parent 52,50 : top 52,50 : left 52,10 : width 52,360 : height 52,240
button 53 : parent 53,50 : top 53,170 : left 53,390 : width 53,20 : caption 53,">>>" : on_click 53,mod_subroutine_code
button 54 : parent 54,50 : top 54,20 : left 54,390 : width 54,20 : caption 54,"+" : on_click 54,add_subroutine_code


flag_start_exists% = 0
element_number% = 1000
xtop% = 50 : xleft% = 220
crlf$ = chr$(13) + chr$(10)
event_modif% = 0
subroutine_modif% = 0
id_string$ = "' *** Designer Project ***"
end

mod_start_label:
hide 32 : hide 33 : hide 40 : hide 50
top 31,80 : left 31,270 :  height 31,650 : width 31,600
top 34,15 : left 34,10 : height 34,620 : width 34,550
top 37,15 : left 37,570 : width 37,20 : caption 37,"<<<" : on_click 37,mod_start_label_restore
return
mod_start_label_restore:
top 31,80 : left 31,270 :  height 31,80 : width 31,280
top 34,15 : left 34,10 : height 34,55 : width 34,220
top 37,15 : left 37,240 : width 37,20 : caption 37,">>>" : on_click 37,mod_start_label
show 32 : show 33 : show 40 : show 50
return

mod_start_dim:
hide 31 : hide 33 : hide 40 : hide 50
top 32,80 : left 32,270 :  height 32,650 : width 32,600
top 35,15 : left 35,10 : height 35,620 : width 35,550
top 38,15 : left 38,570 : width 38,20 : caption 38,"<<<" : on_click 38,mod_start_dim_restore
return
mod_start_dim_restore:
top 32,170 : left 32,270 : height 32,80 : width 32,280
top 35,15 : left 35,10 : height 35,55 : width 35,220
top 38,15 : left 38,240 : width 38,20 : on_click 38,mod_start_dim
show 31 : show 33 : show 40 : show 50
return

mod_start_code:
hide 31 : hide 32 : hide 40 : hide 50
top 33,80 : left 33,270 :  height 33,650 : width 33,600
top 36,15 : left 36,10 : height 36,620 : width 36,550
top 39,15 : left 39,570 : width 39,20 : caption 39,"<<<" : on_click 39,mod_start_code_restore
return
mod_start_code_restore:
top 33,260 : left 33,270 : height 33,80 : width 33,280
top 36,15 : left 36,10 : height 36,55 : width 36,220
top 39,15 : left 39,240 : width 39,20 : caption 39,">>>" : on_click 39,mod_start_code
show 31 : show 32 : show 40 : show 50
return

mod_event_code:
hide 50
top 40,80 : left 40,270 :  height 40,650 : width 40,600
top 42,50 : left 42,10 : width 42,520 : height 42,590
left 43,550 : caption 43,"<<<" : on_click 43,mod_event_code_restore
return
mod_event_code_restore:
top 42,50 : left 42,10 : width 42,360 : height 42,240
top 40,400 : left 40,260 : width 40,430 : height 40,300 : caption 40,"Events"
left 43,390 : caption 43,">>>" : on_click 43,mod_event_code
show 50
return

mod_subroutine_code:
hide 40
top 50,80 : left 50,270 :  height 50,650 : width 50,600
top 52,50 : left 52,10 : width 52,520 : height 52,590
left 53,550 : caption 53,"<<<" : on_click 53,mod_subroutine_code_restore
return
mod_subroutine_code_restore:
top 50,400 : left 50,700 : width 50,430 : height 50,300
top 52,50 : left 52,10 : width 52,360 : height 52,240
left 53,390 : caption 53,">>>" : on_click 53,mod_subroutine_code
show 40
return

add_event_code:
nom$ = message_input$("New event","Routine name:","")
if nom$<>""
  i% = count(41)
  if i%>0
      for j%=1 to i%
          if event_noms$(j%)=nom$
              i% = message_error_ok("Event routine already exists !")
              return
          end_if
      next j%
  end_if
  if event_modif%>0
      n% = event_modif%
      gosub save_event
  end_if
  item_add 41,nom$
  text 41,nom$
  clear 42
  item_add 42,nom$+":"
  item_add 42,"return"
  n% = count(41)
  event_noms$(n%) = nom$
  gosub save_event
  event_modif% = n%
end_if
return
add_subroutine_code:
nom$ = message_input$("New subroutine","Routine name:","")
if nom$<>""
  i% = count(51)
  if i%>0
      for j%=1 to i%
          if subroutine_noms$(j%)=nom$
              i% = message_error_ok("Subroutine already exists !")
              return
          end_if
      next j%
  end_if
  if subroutine_modif%>0
      n% = subroutine_modif%
      gosub save_subroutine
  end_if
  item_add 51,nom$
  text 51,nom$
  clear 52
  item_add 52,nom$+":"
  item_add 52,"return"
  n% = count(51)
  subroutine_noms$(n%) = nom$
  gosub save_subroutine
  subroutine_modif% = n%
end_if
return

save_event:
item_delete 42,1
item_insert 42,1,item_read$(41,n%) + ":"
save_event_1:
s1$ = ""
for k%=1 to count(42)
    s1$ = s1$ + crlf$ + item_read$(42,k%)
next k%
event_codes$(n%) = right$(s1$,len(s1$)-2)
return
save_subroutine:
item_delete 52,1
item_insert 52,1,item_read$(51,n%) + ":"
save_subroutine_1:
s1$ = ""
for k%=1 to count(52)
    s1$ = s1$ + crlf$ + item_read$(52,k%)
next k%
subroutine_codes$(n%) = right$(s1$,len(s1$)-2)
return

change_event:
nom$ = text$(41)
if count(41)>0
    for i%=1 to count(41)
        if event_noms$(i%)=nom$
            if event_modif%>0
                n% = event_modif%
                gosub save_event
            end_if
            clear 42
            item_add 42,event_codes$(i%)
            event_modif% = i%
            return
        end_if
    next i%
else
    text 41,""
end_if
return
change_subroutine:
nom$ = text$(51)
if count(51)>0
    for i%=1 to count(51)
        if subroutine_noms$(i%)=nom$
            if subroutine_modif%>0
                n% = subroutine_modif%
                gosub save_subroutine
            end_if
            clear 52
            item_add 52,subroutine_codes$(i%)
            subroutine_modif% = i%
            return
        end_if
    next i%
else
    text 51,""
end_if
return

load_project:
bas$ = file_name$(17)
if bas$<>"_"
    if right$(bas$,4)<>".bas" then bas$ = bas$ + ".bas"
    if file_exists(bas$)=0
        i% = message_error_ok("File does not exist:"+crlf$+bas$)
        return
    end_if
    nom$ = "inconnu"
    for i%=len(bas$) to 1 step -1
        if mid$(bas$,i%,1)=""
            nom$ = right$(bas$,len(bas$)-i%)
            exit_for
        end_if
    next i%
    file_open_read 2,bas$
    file_readln 2,s$
    if s$<>id_string$
        i% = message_error_ok("Not a valid Designer file"+crlf$+bas$)
        file_close 2
        return
    end_if
    gosub reset
    file_readln 2,s$
    if left$(s$,6)<>"' *** " then goto load_invalid
    file_readln 2,s$
    if s$<>"' *** Designer Labels ***" then goto load_invalid
    file_readln 2,s$
    while s$<>"' *** Designer Event Labels ***"
        item_add 34,s$
        file_readln 2,s$
    end_while
    file_readln 2,s$
    while s$<>"' *** Designer Dims ***"
        file_readln 2,s$
    end_while
    file_readln 2,s$
    while s$<>"' *** Designer Application Start Code ***"
        item_add 35,s$
        file_readln 2,s$
    end_while
    file_readln 2,s$
    while s$<>"' *** Designer End of static code ***"
        item_add 36,s$
        file_readln 2,s$
    end_while
    file_readln 2,s$
    if s$<>"End" then goto load_invalid
    file_readln 2,s$
    while instr(s$,"' *** Designer Event Routine: ")=1
        s$ = left$(s$,len(s$)-4)
        item_add 41,right$(s$,len(s$)-instr(s$,":")-1)
        text 41,item_read$(41,count(41))
        event_noms$(count(41)) = item_read$(41,count(41))
        clear 42
        file_readln 2,s$
        while instr(s$,"' *** Designer ")<>1
            item_add 42,s$
            file_readln 2,s$
        end_while
        n% = count(41)
        gosub save_event_1
        event_modif% = n%
    end_while
    while instr(s$,"' *** Designer Subroutine: ")=1
        s$ = left$(s$,len(s$)-4)
        item_add 51,right$(s$,len(s$)-instr(s$,":")-1)
        text 51,item_read$(51,count(51))
        subroutine_noms$(count(51)) = item_read$(51,count(51))
        clear 52
        file_readln 2,s$
        while instr(s$,"' *** Designer ")<>1
            item_add 52,s$
            file_readln 2,s$
        end_while
        n% = count(51)
        gosub save_subroutine_1
        subroutine_modif% = n%
    end_while
    if s$<>"' *** Designer End of Project ***" then goto load_invalid
    file_close 2
end_if
return
load_invalid:
i% = message_error_ok("Not a valid Designer file"+crlf$+bas$+crlf$+s$)
file_close 2
gosub reset
return

reset:
clear 34 : clear 35 : clear 36 : clear 41 : clear 42 : clear 51 : clear 52
event_modif% = 0 : subroutine_modif% = 0
return

save_project:
bas$ = file_name$(18)
if bas$<>"_"
    if right$(bas$,4)<>".bas" then bas$ = bas$ + ".bas"
    if file_exists(bas$)=1
        if message_confirmation_yes_no("Do you want to eplace existing file "+crlf$+bas$)<>1 then return
    end_if
    nom$ = "inconnu"
    for i%=len(bas$) to 1 step -1
        if mid$(bas$,i%,1)=""
            nom$ = right$(bas$,len(bas$)-i%)
            exit_for
        end_if
    next i%
    file_open_write 2,bas$
    file_writeln 2,id_string$
    file_writeln 2,"' *** " + nom$ + " ***"
    s$ = ""
    if count(34)>0
        for i%=1 to count(34)
            s$ = s$ + crlf$ + item_read$(34,i%)
        next i%
        s$ = right$(s$,len(s$)-2)
    end_if
    file_writeln 2,"' *** Designer Labels ***"
    file_writeln 2,s$

    file_writeln 2,"' *** Designer Event Labels ***"
    s$ = ""
    if count(41)>0
        for i%=1 to count(41)
            file_writeln 2,"Label "+item_read$(41,i%)+":"
        next i%
    end_if
    file_writeln 2,"' *** Designer Subroutine Labels ***"
    s$ = ""
    if count(51)>0
        for i%=1 to count(51)
            file_writeln 2,"Label "+item_read$(51,i%)+":"
        next i%
    end_if

    s$ = ""
    if count(35)>0
        for i%=1 to count(35)
            s$ = s$ + crlf$ + item_read$(35,i%)
        next i%
        s$ = right$(s$,len(s$)-2)
    end_if
    file_writeln 2,"' *** Designer Dims ***"
    file_writeln 2,s$
    s$ = ""
    if count(36)>0
        for i%=1 to count(36)
            s$ = s$ + crlf$ + item_read$(36,i%)
        next i%
        s$ = right$(s$,len(s$)-2)
    end_if
    file_writeln 2,"' *** Designer Application Start Code ***"
    file_writeln 2,s$
    file_writeln 2,"' *** Designer End of static code ***"
    file_writeln 2,"End"
   
    if count(41)>0
        gosub save_event
        for i%=1 to count(41)
            file_writeln 2,"' *** Designer Event Routine: "+item_read$(41,i%)+" ***"
            file_writeln 2,event_codes$(i%)
        next i%
    end_if
    if count(51)>0
        gosub save_subroutine
        for i%=1 to count(51)
            file_writeln 2,"' *** Designer Subroutine: "+item_read$(51,i%)+" ***"
            file_writeln 2,subroutine_codes$(i%)
        next i%
    end_if
    file_writeln 2,"' *** Designer End of Project ***"
    file_close 2
end_if
return

exit:
if message_confirmation_yes_no("Really quit the Designer ?")=1 then terminate
return
Revenir en haut Aller en bas
http://klauspanoramic.comxa.com/index.html
Invité
Invité




Outil de génération d'une structure Panoramic valide Empty
MessageSujet: Re: Outil de génération d'une structure Panoramic valide   Outil de génération d'une structure Panoramic valide EmptySam 15 Jan 2011 - 13:39

J'ai vu cette nuit ton programme, et je l'ai essayé.

Seulement le code qui est sauvegardé a des erreurs.
J'ai pas voulu sur le coup en faire la remarque, vu que je pensais que tu allais t'en apercevoir.

Je viens de vérifier, et il n'y a pas de correction.
En déclarant les dims, pourquoi dim n'est pas devant?
Pour les labels déclarés, il y a deux points, ce qui engendrera une erreur.

L'idée n'est pas mauvaise, et peut si on veut remplacer un tuto, en montrant comment se goupille un code en Panoramic. Encore faut-il qu'il n'y ait pas d'erreurs dans la génération du code, ensuite il faudrait accompagner ton programme d'une aide très explicative, parce que employer des mots comme events et subroutine qui sont la même chose dans la finalité, puisqu'il s'agit du même type de sous programme (mais l'idée de séparation dans le concept n'est pas mauvaise).

Le problème est qu'un programme se perd dans tous les message du forum. Il faudrait avoir la possibilité de pouvoir bien mettre en avant quelques programmes pour que les tous nouveaux voient tout de suite une méthode de départ.

Beaucoup d'entre vous avait fait un forum, plus d'une fois j'y ai pensé. Je me demande si il serait possible que chacun d'entre nous dans le forum actuel, puisse avoir une place à part pour y mettre les choses importantes, vu qu'il s'agit toujours de Panoramic.

Ça me gène de faire un site, alors que la seule chose que j'ai à y mettre, est justement des programmes Panoramic. Le jour où je pense que ce que j'ai à y mettre est important, alors là oui, ce serait normal pour moi d'en faire un.

Ce serait bon d'avoir dans l'accueil une partie qui ne soit destiné qu'aux nouveaux arrivants, et Jack ferait le choix pour ce qu'il accepte d'y mettre.
Revenir en haut Aller en bas
Klaus

Klaus


Nombre de messages : 12294
Age : 74
Localisation : Ile de France
Date d'inscription : 29/12/2009

Outil de génération d'une structure Panoramic valide Empty
MessageSujet: Re: Outil de génération d'une structure Panoramic valide   Outil de génération d'une structure Panoramic valide EmptySam 15 Jan 2011 - 13:46

J'ai dû mal m'exprimer. Dans les rubriques labels et dims, il faut lettre les lignes Panoramic complèetes, pas juste les noms des labels ou des variables.

Voici un exemple généré par Designer. On peut le charger par Load, le modifier, puis le sauver par Save.
Code:
' *** Designer Project ***
' *** test1.bas ***
' *** Designer Labels ***
label ok, text
label essai
' *** Designer Event Labels ***
Label E1:
Label E2:
' *** Designer Subroutine Labels ***
Label charger:
Label sauver:
' *** Designer Dims ***
dim i%, s$
dim b(200)
' *** Designer Application Start Code ***
i% = 1
' *** Designer End of static code ***
End
' *** Designer Event Routine: E1 ***
E1:
s$ = str$(i%)
return
' *** Designer Event Routine: E2 ***
E2:
i% = i% + 1
return
' *** Designer Subroutine: charger ***
charger:
message "charger"
return
' *** Designer Subroutine: sauver ***
sauver:
message "sauver"
return
' *** Designer End of Project ***

Comme tu peux voir, le code est valide - sans problème.
Revenir en haut Aller en bas
http://klauspanoramic.comxa.com/index.html
Yannick




Nombre de messages : 8610
Age : 53
Localisation : Bretagne
Date d'inscription : 15/02/2010

Outil de génération d'une structure Panoramic valide Empty
MessageSujet: Re: Outil de génération d'une structure Panoramic valide   Outil de génération d'une structure Panoramic valide EmptySam 15 Jan 2011 - 13:54

attention !

Label text

code invalide à cause de text qui est un mot clé

ligne 7 8 10 11

ton prog ponctu avec " :" ce qui crée une erreur a cet endroit

pale
Revenir en haut Aller en bas
Klaus

Klaus


Nombre de messages : 12294
Age : 74
Localisation : Ile de France
Date d'inscription : 29/12/2009

Outil de génération d'une structure Panoramic valide Empty
MessageSujet: Re: Outil de génération d'une structure Panoramic valide   Outil de génération d'une structure Panoramic valide EmptySam 15 Jan 2011 - 14:45

Tu as raison pour le ":". Voici la correction. De plus, j'ai ajouté un menu, un affichage de mode d'emploi et un écran a-propos. J'ai aussi corrigé le programme de démo pour le label test:

Designer.bas
Code:


label mod_start_label, mod_start_dim, mod_start_code
label mod_start_label_restore, mod_start_dim_restore, mod_start_code_restore
label mod_event_code, mod_subroutine_code, generate, options, options_1, close_options
label mod_event_code_restore, mod_subroutine_code_restore, init_langage
label add_event_code, add_subroutine_code, save_event, save_subroutine
label remove_event_code, remove_subroutine_code, call_event_code, call_subroutine_code
label save_event_1, save_subroutine_1, change_langage
label change_event, change_subroutine, show_code, close_show, show_code_1
label close_doc, documentation, documentation_1, documentation_load
label load_project, save_project, exit, reset, load_invalid, a_propos

dim i%, j%, k%, n%, s$, s1$, xtop%, xleft%, nom$, crlf$, bas$, id_string$
dim type$, type%, flag_start_exists%, element_number%, show$, langage%
dim event_noms$(300), event_codes$(300), event_modif%, t$(5,100)
dim subroutine_noms$(300), subroutine_codes$(300), subroutine_modif%
dim date_version$, numero_version$

date_version$ = "17/01/2011"
numero_version$ = "V01.04"

gosub init_langage

width 0,1200 : height 0,800

main_menu 61
  sub_menu 62 : parent 62,61 : caption 62,t$(langage%,0)
    sub_menu 63 : parent 63,62 : caption 63,t$(langage%,1) : on_click 63,load_project
    sub_menu 64 : parent 64,62 : caption 64,t$(langage%,2) : on_click 64,save_project
    sub_menu 65 : parent 65,62 : caption 65,t$(langage%,3) : on_click 65,show_code
    sub_menu 66 : parent 66,62 : caption 66,"-------"
    sub_menu 67 : parent 67,62 : caption 67,t$(langage%,4) : on_click 67,exit
  sub_menu 70 : parent 70,61 : caption 70,t$(langage%,5)
    sub_menu 71 : parent 71,70 : caption 71,t$(langage%,6) : on_click 71,documentation
    sub_menu 72 : parent 72,70 : caption 72,t$(langage%,7) : on_click 72,options
    sub_menu 73 : parent 73,70 : caption 73,"-------------"
    sub_menu 74 : parent 74,70 : caption 74,t$(langage%,8) : on_click 74,a_propos

container 10 : top 10,40 : left 10,10 : caption 10,t$(langage%,9) : height 10,500 : width 10,200
button 11 : parent 11,10 : top 11,20 : left 11,10 : caption 11,t$(langage%,1) : on_click 11,load_project
button 12 : parent 12,10 : top 12,50 : left 12,10 : caption 12,t$(langage%,2) : on_click 12,save_project
button 13 : parent 13,10 : top 13,80 : left 13,10 : caption 13,t$(langage%,3) : on_click 13,show_code
button 14 : parent 14,10 : top 14,110 : left 14,10 : caption 14,t$(langage%,7) : on_click 14,options
button 15 : parent 15,10 : top 15,170 : left 15,10 : caption 15,t$(langage%,4) : on_click 15,exit

open_dialog 17 : filter 17,"Project Designer|*.bas"
save_dialog 18 : filter 18,"Project Designer|*.bas"

picture 20 : top 20,40 : left 20,250 : width 20,900 : height 20,700
2d_target_is 20 : 2d_rectangle 5,5,895,695
print_target_is 20 : print_locate 10,0 : print t$(langage%,10)

picture 30 : top 30,60 : left 30,260 : width 30,300 : height 30,300
2d_target_is 30 : color 30,185,244,244 : 2d_fill_color 185,244,244
2d_rectangle 5,5,295,295
print_target_is 30 : print_locate 10,0  : print "Application_Start"
container 31 : top 31,80 : left 31,270 : caption 31,t$(langage%,11) : height 31,80 : width 31,280
container 32 : top 32,170 : left 32,270 : caption 32,t$(langage%,12) : height 32,80 : width 32,280
container 33 : top 33,260 : left 33,270 : caption 33,t$(langage%,13) : height 33,80 : width 33,280
memo 34 : parent 34,31 : top 34,15 : left 34,10 : height 34,55 : width 34,220 : bar_vertical 34
memo 35 : parent 35,32 : top 35,15 : left 35,10 : height 35,55 : width 35,220 : bar_vertical 35
memo 36 : parent 36,33 : top 36,15 : left 36,10 : height 36,55 : width 36,220 : bar_vertical 36
button 37 : parent 37,31 : top 37,15 : left 37,240 : width 37,20 : caption 37,">>>" : on_click 37,mod_start_label
button 38 : parent 38,32 : top 38,15 : left 38,240 : width 38,20 : caption 38,">>>" : on_click 38,mod_start_dim
button 39 : parent 39,33 : top 39,15 : left 39,240 : width 39,20 : caption 39,">>>" : on_click 39,mod_start_code

container 40 : top 40,400 : left 40,260 : width 40,430 : height 40,300 : caption 40,t$(langage%,14)
combo 41 : parent 41,40 : top 41,20 : left 41,10 : width 41,360  : on_change 41,change_event
memo 42 : parent 42,40 : top 42,50 : left 42,10 : width 42,360 : height 42,240
button 43 : parent 43,40 : top 43,170 : left 43,390 : width 43,30 : caption 43,">>>" : on_click 43,mod_event_code
button 44 : parent 44,40 : top 44,20 : left 44,390 : width 44,30 : caption 44,"+" : on_click 44,add_event_code
button 45 : parent 45,40 : top 45,50 : left 45,390 : width 45,30 : caption 45,"-" : on_click 45,remove_event_code
button 46 : parent 46,40 : top 46,80 : left 46,390 : width 46,30 : caption 46,"Call" : on_click 46,call_event_code

container 50 : top 50,400 : left 50,700 : width 50,430 : height 50,300 : caption 50,t$(langage%,15)
combo 51 : parent 51,50 : top 51,20 : left 51,10 : width 51,360 : on_change 51,change_subroutine
memo 52 : parent 52,50 : top 52,50 : left 52,10 : width 52,360 : height 52,240
button 53 : parent 53,50 : top 53,170 : left 53,390 : width 53,30 : caption 53,">>>" : on_click 53,mod_subroutine_code
button 54 : parent 54,50 : top 54,20 : left 54,390 : width 54,30 : caption 54,"+" : on_click 54,add_subroutine_code
button 55 : parent 55,50 : top 55,50 : left 55,390 : width 55,30 : caption 55,"-" : on_click 55,remove_subroutine_code
button 56 : parent 56,50 : top 56,80 : left 56,390 : width 56,30 : caption 56,"Call" : on_click 56,call_subroutine_code


flag_start_exists% = 0
element_number% = 1000
xtop% = 50 : xleft% = 220
crlf$ = chr$(13) + chr$(10)
event_modif% = 0
subroutine_modif% = 0
id_string$ = "' *** Designer Project ***"
end

mod_start_label:
hide 32 : hide 33 : hide 40 : hide 50
top 31,80 : left 31,270 :  height 31,650 : width 31,600
top 34,15 : left 34,10 : height 34,620 : width 34,550
top 37,15 : left 37,570 : width 37,20 : caption 37,"<<<" : on_click 37,mod_start_label_restore
return
mod_start_label_restore:
top 31,80 : left 31,270 :  height 31,80 : width 31,280
top 34,15 : left 34,10 : height 34,55 : width 34,220
top 37,15 : left 37,240 : width 37,20 : caption 37,">>>" : on_click 37,mod_start_label
show 32 : show 33 : show 40 : show 50
return

mod_start_dim:
hide 31 : hide 33 : hide 40 : hide 50
top 32,80 : left 32,270 :  height 32,650 : width 32,600
top 35,15 : left 35,10 : height 35,620 : width 35,550
top 38,15 : left 38,570 : width 38,20 : caption 38,"<<<" : on_click 38,mod_start_dim_restore
return
mod_start_dim_restore:
top 32,170 : left 32,270 : height 32,80 : width 32,280
top 35,15 : left 35,10 : height 35,55 : width 35,220
top 38,15 : left 38,240 : width 38,20 : on_click 38,mod_start_dim
show 31 : show 33 : show 40 : show 50
return

mod_start_code:
hide 31 : hide 32 : hide 40 : hide 50
top 33,80 : left 33,270 :  height 33,650 : width 33,600
top 36,15 : left 36,10 : height 36,620 : width 36,550
top 39,15 : left 39,570 : width 39,20 : caption 39,"<<<" : on_click 39,mod_start_code_restore
return
mod_start_code_restore:
top 33,260 : left 33,270 : height 33,80 : width 33,280
top 36,15 : left 36,10 : height 36,55 : width 36,220
top 39,15 : left 39,240 : width 39,20 : caption 39,">>>" : on_click 39,mod_start_code
show 31 : show 32 : show 40 : show 50
return

mod_event_code:
hide 50
top 40,80 : left 40,270 :  height 40,650 : width 40,600
top 42,50 : left 42,10 : width 42,520 : height 42,590
left 43,550 : caption 43,"<<<" : on_click 43,mod_event_code_restore
left 44,550 : left 45,550 : left 46,550
return
mod_event_code_restore:
top 42,50 : left 42,10 : width 42,360 : height 42,240
top 40,400 : left 40,260 : width 40,430 : height 40,300
left 43,390 : caption 43,">>>" : on_click 43,mod_event_code
left 44,390 : left 45,390 : left 46,390
show 50
return

mod_subroutine_code:
hide 40
top 50,80 : left 50,270 :  height 50,650 : width 50,600
top 52,50 : left 52,10 : width 52,520 : height 52,590
left 53,550 : caption 53,"<<<" : on_click 53,mod_subroutine_code_restore
left 54,550 : left 55,550 : left 56,550
return
mod_subroutine_code_restore:
top 50,400 : left 50,700 : width 50,430 : height 50,300
top 52,50 : left 52,10 : width 52,360 : height 52,240
left 53,390 : caption 53,">>>" : on_click 53,mod_subroutine_code
left 54,390 : left 55,390 : left 56,390
show 40
return

call_event_code:
if event_modif%=0
    i% = message_error_ok(t$(langage%,16))
    return
end_if
nom$ = message_input$(t$(langage%,17),t$(langage%,18),"")
if nom$<>""
    if count(41)>0
        for i%=1 to count(41)
            if lower$(event_noms$(i%))=lower$(nom$)
                i% = message_error_ok(t$(langage%,19))
                return
            end_if
        next i%
    end_if
    k% = 0
    if count(51)>0
        for i%=1 to count(51)
            if lower$(subroutine_noms$(i%))=lower$(nom$)
                k% = i%
                exit_for
            end_if
        next i%
    end_if
    if k%=0
        item_add 51,nom$
        subroutine_noms$(count(51)) = nom$
        subroutine_codes$(count(51)) = nom$+":"+crlf$+"Return"
        if subroutine_modif%=0
            text 51,nom$
            clear 52
            item_add 52,subroutine_codes$(count(51))
        end_if
    end_if
    item_insert 42,count(42),"gosub "+nom$
end_if
return
call_subroutine_code:
if subroutine_modif%=0
    i% = message_error_ok(t$(langage%,20))
    return
end_if
nom$ = message_input$(t$(langage%,17),t$(langage%,18),"")
if nom$<>""
    if count(41)>0
        for i%=1 to count(41)
            if lower$(event_noms$(i%))=lower$(nom$)
                i% = message_error_ok(t$(langage%,19))
                return
            end_if
        next i%
    end_if
    k% = 0
    if count(51)>0
        for i%=1 to count(51)
            if lower$(subroutine_noms$(i%))=(nom$)
                k% = i%
                exit_for
            end_if
        next i%
    end_if
    if k%=0
        item_add 51,nom$
        subroutine_noms$(count(51)) = nom$
        subroutine_codes$(count(51)) = nom$+":"+crlf$+"Return"
        if subroutine_modif%=0
            text 51,nom$
            clear 52
            item_add 52,subroutine_codes$(count(51))
        end_if
    end_if
    item_insert 52,count(52),"gosub "+nom$
end_if
return

remove_event_code:
if event_modif%=0
    i% = message_error_ok(t$(langage%,16))
    return
end_if
if message_confirmation_yes_no(t$(langage%,21)+event_noms$(event_modif%))=1
    if count(41)>0
        for i%=event_modif% to count(41)-1
            event_noms$(i%) = event_noms$(i%+1)
            event_codes$(i%) = event_codes$(i%+1)
        next i%
    end_if
    item_delete 41,event_modif%
    clear 42
    text 41,""
    event_modif% = event_modif% - 1
    if (count(41)>0) and (event_modif%=0) then event_modif% = 1
    if event_modif%>0
        i% = event_modif%
        nom$ = event_noms$(i%)
        text 41,nom$
        item_add 42,event_codes$(i%)
    end_if
end_if
return
remove_subroutine_code:
if subroutine_modif%=0
    i% = message_error_ok(t$(langage%,20))
    return
end_if
if message_confirmation_yes_no(t$(langage%,22)+subroutine_noms$(subroutine_modif%))=1
    if count(51)>0
        for i%=subroutine_modif% to count(51)-1
            subroutine_noms$(i%) = subroutine_noms$(i%+1)
            subroutine_codes$(i%) = subroutine_codes$(i%+1)
        next i%
    end_if
    item_delete 51,subroutine_modif%
    clear 52
    text 51,""
    subroutine_modif% = subroutine_modif% - 1
    if (count(51)>0) and (subroutine_modif%=0) then subroutine_modif% = 1
    if subroutine_modif%>0
        i% = subroutine_modif%
        nom$ = subroutine_noms$(i%)
        text 51,nom$
        item_add 52,subroutine_codes$(i%)
    end_if
end_if
return

add_event_code:
nom$ = message_input$(t$(langage%,23),t$(langage%,24),"")
if nom$<>""
  i% = count(41)
  if i%>0
      for j%=1 to i%
          if event_noms$(j%)=nom$
              i% = message_error_ok(t$(langage%,25))
              return
          end_if
      next j%
  end_if
  if event_modif%>0
      n% = event_modif%
      gosub save_event
  end_if
  item_add 41,nom$
  text 41,nom$
  clear 42
  item_add 42,nom$+":"
  item_add 42,"return"
  n% = count(41)
  event_noms$(n%) = nom$
  gosub save_event
  event_modif% = n%
end_if
return
add_subroutine_code:
nom$ = message_input$(t$(langage%,26),t$(langage%,24),"")
if nom$<>""
  i% = count(51)
  if i%>0
      for j%=1 to i%
          if subroutine_noms$(j%)=nom$
              i% = message_error_ok(t$(langage%,27))
              return
          end_if
      next j%
  end_if
  if subroutine_modif%>0
      n% = subroutine_modif%
      gosub save_subroutine
  end_if
  item_add 51,nom$
  text 51,nom$
  clear 52
  item_add 52,nom$+":"
  item_add 52,"return"
  n% = count(51)
  subroutine_noms$(n%) = nom$
  gosub save_subroutine
  subroutine_modif% = n%
end_if
return

save_event:
item_delete 42,1
item_insert 42,1,item_read$(41,n%) + ":"
save_event_1:
s1$ = ""
for k%=1 to count(42)
    s1$ = s1$ + crlf$ + item_read$(42,k%)
next k%
event_codes$(n%) = right$(s1$,len(s1$)-2)
return
save_subroutine:
item_delete 52,1
item_insert 52,1,item_read$(51,n%) + ":"
save_subroutine_1:
s1$ = ""
for k%=1 to count(52)
    s1$ = s1$ + crlf$ + item_read$(52,k%)
next k%
subroutine_codes$(n%) = right$(s1$,len(s1$)-2)
return

change_event:
nom$ = text$(41)
if count(41)>0
    for i%=1 to count(41)
        if event_noms$(i%)=nom$
            if event_modif%>0
                n% = event_modif%
                gosub save_event
            end_if
            clear 42
            item_add 42,event_codes$(i%)
            event_modif% = i%
            return
        end_if
    next i%
else
    text 41,""
end_if
return
change_subroutine:
nom$ = text$(51)
if count(51)>0
    for i%=1 to count(51)
        if subroutine_noms$(i%)=nom$
            if subroutine_modif%>0
                n% = subroutine_modif%
                gosub save_subroutine
            end_if
            clear 52
            item_add 52,subroutine_codes$(i%)
            subroutine_modif% = i%
            return
        end_if
    next i%
else
    text 51,""
end_if
return

load_project:
bas$ = file_name$(17)
if bas$<>"_"
    if right$(bas$,4)<>".bas" then bas$ = bas$ + ".bas"
    if file_exists(bas$)=0
        i% = message_error_ok(t$(langage%,28)+crlf$+bas$)
        return
    end_if
    nom$ = "inconnu"
    for i%=len(bas$) to 1 step -1
        if mid$(bas$,i%,1)=""
            nom$ = right$(bas$,len(bas$)-i%)
            exit_for
        end_if
    next i%
    file_open_read 2,bas$
    file_readln 2,s$
    if s$<>id_string$
        i% = message_error_ok(t$(langage%,29)+crlf$+bas$)
        file_close 2
        return
    end_if
    gosub reset
    file_readln 2,s$
    if left$(s$,6)<>"' *** " then goto load_invalid
    file_readln 2,s$
    if s$<>"' *** Designer Labels ***" then goto load_invalid
    file_readln 2,s$
    while s$<>"' *** Designer Event Labels ***"
        item_add 34,s$
        file_readln 2,s$
    end_while
    file_readln 2,s$
    while s$<>"' *** Designer Dims ***"
        file_readln 2,s$
    end_while
    file_readln 2,s$
    while s$<>"' *** Designer Application Start Code ***"
        item_add 35,s$
        file_readln 2,s$
    end_while
    file_readln 2,s$
    while s$<>"' *** Designer End of static code ***"
        item_add 36,s$
        file_readln 2,s$
    end_while
    file_readln 2,s$
    if s$<>"End" then goto load_invalid
    file_readln 2,s$
    while instr(s$,"' *** Designer Event Routine: ")=1
        s$ = left$(s$,len(s$)-4)
        item_add 41,right$(s$,len(s$)-instr(s$,":")-1)
        text 41,item_read$(41,count(41))
        event_noms$(count(41)) = item_read$(41,count(41))
        clear 42
        file_readln 2,s$
        while instr(s$,"' *** Designer ")<>1
            item_add 42,s$
            file_readln 2,s$
        end_while
        n% = count(41)
        gosub save_event_1
        event_modif% = n%
    end_while
    while instr(s$,"' *** Designer Subroutine: ")=1
        s$ = left$(s$,len(s$)-4)
        item_add 51,right$(s$,len(s$)-instr(s$,":")-1)
        text 51,item_read$(51,count(51))
        subroutine_noms$(count(51)) = item_read$(51,count(51))
        clear 52
        file_readln 2,s$
        while instr(s$,"' *** Designer ")<>1
            item_add 52,s$
            file_readln 2,s$
        end_while
        n% = count(51)
        gosub save_subroutine_1
        subroutine_modif% = n%
    end_while
    if s$<>"' *** Designer End of Project ***" then goto load_invalid
    file_close 2
end_if
return
load_invalid:
i% = message_error_ok(t$(langage%,29)+crlf$+bas$+s$)
file_close 2
gosub reset
return

reset:
clear 34 : clear 35 : clear 36 : clear 41 : clear 42 : clear 51 : clear 52
event_modif% = 0 : subroutine_modif% = 0
return

save_project:
bas$ = file_name$(18)
if bas$<>"_"
    if right$(bas$,4)<>".bas" then bas$ = bas$ + ".bas"
    if file_exists(bas$)=1
        if message_confirmation_yes_no(t$(langage%,30)+crlf$+bas$)<>1 then return
    end_if
    nom$ = "inconnu"
    for i%=len(bas$) to 1 step -1
        if mid$(bas$,i%,1)=""
            nom$ = right$(bas$,len(bas$)-i%)
            exit_for
        end_if
    next i%
    gosub generate
    file_open_write 2,bas$
    file_writeln 2,show$
    file_close 2
end_if
return

generate:
    show$ = ""
    show$ = show$ + id_string$
    show$ = show$ + crlf$ + "' *** " + nom$ + " ***"
    s$ = ""
    if count(34)>0
        for i%=1 to count(34)
            s$ = s$ + crlf$ + item_read$(34,i%)
        next i%
        s$ = right$(s$,len(s$)-2)
    end_if
    show$ = show$ + crlf$ + "' *** Designer Labels ***"
    show$ = show$ + crlf$ + s$

    show$ = show$ + crlf$ + "' *** Designer Event Labels ***"
    s$ = ""
    if count(41)>0
        for i%=1 to count(41)
            show$ = show$ + crlf$ + "Label "+item_read$(41,i%)
        next i%
    end_if
    show$ = show$ + crlf$ + "' *** Designer Subroutine Labels ***"
    s$ = ""
    if count(51)>0
        for i%=1 to count(51)
            show$ = show$ + crlf$ + "Label "+item_read$(51,i%)
        next i%
    end_if

    s$ = ""
    if count(35)>0
        for i%=1 to count(35)
            s$ = s$ + crlf$ + item_read$(35,i%)
        next i%
        s$ = right$(s$,len(s$)-2)
    end_if
    show$ = show$ + crlf$ + "' *** Designer Dims ***"
    show$ = show$ + crlf$ + s$
    s$ = ""
    if count(36)>0
        for i%=1 to count(36)
            s$ = s$ + crlf$ + item_read$(36,i%)
        next i%
        s$ = right$(s$,len(s$)-2)
    end_if
    show$ = show$ + crlf$ + "' *** Designer Application Start Code ***"
    show$ = show$ + crlf$ + s$
    show$ = show$ + crlf$ + "' *** Designer End of static code ***"
    show$ = show$ + crlf$ + "End"

    if count(41)>0
        gosub save_event
        for i%=1 to count(41)
            show$ = show$ + crlf$ + "' *** Designer Event Routine: "+item_read$(41,i%)+" ***"
            show$ = show$ + crlf$ + event_codes$(i%)
        next i%
    end_if
    if count(51)>0
        gosub save_subroutine
        for i%=1 to count(51)
            show$ = show$ + crlf$ + "' *** Designer Subroutine: "+item_read$(51,i%)+" ***"
            show$ = show$ + crlf$ + subroutine_codes$(i%)
        next i%
    end_if
    show$ = show$ + crlf$ + "' *** Designer End of Project ***"
return

exit:
if message_confirmation_yes_no(t$(langage%,31))=1 then terminate
return

a_propos:
i% = message_information_OK(t$(langage%,32)+numero_version$+crlf$+t$(langage%,33)+crlf$+t$(langage%,34)+date_version$)
return

documentation:
on_error_goto documentation_1
form 710 : hide 710
command_target_is 710 : top 710,100 : left 710,300 : caption 710,"Designer - Documentation" : on_close 710,close_doc
width 710,700 : height 710,500
memo 711 : top 711,10 : left 711,10 : width 711,670 : height 711,400 : font_size 711,12 : bar_vertical 711
button 712 : top 712,430 : left 712,10 : caption 712,"Close" : on_click 712,close_doc
command_target_is 0
documentation_1:
off_error_goto
clear 711
gosub documentation_load
show 710
to_foreground 710
return
close_doc:
hide 710
return
documentation_load:
clear 711
select langage%
case 0
item_add 711,"Panoramic - Designer"
item_add 711,""
item_add 711,"In the Application Start section, valid Panoramic lines must be entered."
item_add 711,"Example:"
item_add 711,"    label test, essai        in the Labels section"
item_add 711,"    dim i%, valeur(25),x$    in the Dims section"
item_add 711,"    i% = 1 : x$ = "+chr$(34)+"test"+chr$(34)+"    in the Code section"
item_add 711,""
item_add 711,"The Events section receives the event routines."
item_add 711,"The Subroutines section receives the internal subroutines."
item_add 711,"In these 2 sections, a routine is added by the [+] button."
item_add 711,"A window is opening asking for the routine name."
item_add 711,"A routine template appears under the routine name field."
item_add 711,"The routine name combo box can be used tu select a routine for modification."
item_add 711,"The [-] button removes an event routine or internal subroutine."
item_add 711,"The [Call] button adds a call tu an internel subroutine."
item_add 711,"  If the latter does not exist, il will be added with its template."
item_add 711,""
item_add 711,"The >>> buttons switch to a larger display of the selected section."
item_add 711,"In this mode, a <<< button switches back to normal display mode."
item_add 711,""
item_add 711,"The following command buttons are available:"
item_add 711,"Load    - load a Designer project"
item_add 711,"Save    - save the actual Designer project"
item_add 711,"Show    - show the code as it would be generated on saving"
case 1
item_add 711,"Panoramic - Designer"
item_add 711,""
item_add 711,"Dans la section Application Start, il faut saisir des lignes Panoramic valides."
item_add 711,"Exemple:"
item_add 711,"    label test, essai        dans la section Labels"
item_add 711,"    dim i%, valeur(25),x$    dans la section Dims"
item_add 711,"    i% = 1 : x$ = "+chr$(34)+"essai"+chr$(34)+"    dans la section Code"
item_add 711,""
item_add 711,"La section Events reçoit les sous-programmmess évènements."
item_add 711,"La section Subroutines reçoit les sous-programmmess internes."
item_add 711,"Pour ces 2 sections, on ajoute un sous-programme par le bouton [+]."
item_add 711,"Une fenêtre s'ouvre alors pour saisir le nom du sous-programme."
item_add 711,"Puis, le squelete de ce sousprogramme apparaît dans le mémo en-dessous du nom."
item_add 711,"On peut utiliser la combobox pour choisir un sous-programme et le modifier."
item_add 711,"Le bouton [-] supprime une routine évènement ou sous-programme interne."
item_add 711,"Le bouton [Call] ajoute un appel à un sous-programme interne."
item_add 711,"  Ce sous-programme sera ajouté s'il n'existe pas encore."
item_add 711,""
item_add 711,"Les boutons >>> basculent vers un affichage plus large de la section choisie."
item_add 711,"Dans ce mode, un bouton <<< bascule à nouveau vers l'affichage normal."
item_add 711,""
item_add 711,"Les boutons de commands suivants sont disponibles:"
item_add 711,"Ouvrir        - charger un projet Designer"
item_add 711,"Enregistrer    - enregistrer le projet Designer actuel"
item_add 711,"Afficher      - montrer le code tel qu'il serait généré en enregistrant"
case 2
item_add 711,"Panoramic - Designer"
item_add 711,""
item_add 711,"In der Application Start Sektion müssen gültige Panoramic Linien eingegeben werden."
item_add 711,"Beispiel:"
item_add 711,"    label test, essai        in der Labels Sektion"
item_add 711,"    dim i%, valeur(25),x$    in der Dims Sektion"
item_add 711,"    i% = 1 : x$ = "+chr$(34)+"essai"+chr$(34)+"    in der Code Sektion"
item_add 711,""
item_add 711,"Die Ereignis-Sektion enhält die Ereignis-Routinen."
item_add 711,"Die Unterprogramm-Sektion enhält alle internen Unterprogramme."
item_add 711,"In diesen 2 Sektionen wird eine Routine durch des [+] Button hinzugefügt."
item_add 711,"Ein Fenster öffnet sich, um den Namen des Routine einzugeben.."
item_add 711,"Ein Template des Routine erscheint dann unter dem Namensfeld."
item_add 711,"Man verwendet dir Combo-Box zur Auswahl einer Routine."
item_add 711,"Der [-] Button löscht eine Ereignis- oder interne Routine."
item_add 711,"Der [Call] Button fûgt einen Aufruf eines internen Unterprogrammes ein."
item_add 711,"  Wenn dieses noch nicht besteht, wird es mit seinem Template eingefügt."
item_add 711,""
item_add 711,"Die >>> Buttons schalten auf einn breiten Abbildunsmodus der betreffenden Sektion um."
item_add 711,"In diesem Modus schaltet der <<< Button auf normalen Abbildsmodus zurück."
item_add 711,""
item_add 711,"Folgende Kommando-Buttons stehen zur Verfügung:"
item_add 711,"Öffnen        - eine Designer Projekt-Datei laden"
item_add 711,"Speichern      - das aktuelle Designer Projekt in eine Datei speichern"
item_add 711,"Anschauen      - den generierten Kode so zeigen, wie er abgespeichert wird"
end_select
return

show_code:
on_error_goto show_code_1
form 720 : hide 720 : width 720,600 : height 720,700 : top 720,30 : left 720,300
command_target_is 720
memo 721 : top 721,10 : left 721,10 : height 721,600 : width 721,550
bar_vertical 721
button 722 : top 722,630 : left 722,10 : caption 722,"Close" : on_click 722,close_show
command_target_is 0
show_code_1:
off_error_goto
    gosub generate
    clear 721
    item_add 721,show$
show 720
to_foreground 720
return
close_show:
hide 720
return

options:
on_error_goto options_1
form 730 : hide 730 : width 730,600 : height 730,200 : top 730,30 : left 730,300
command_target_is 730
combo 731 : top 731,10 : left 731,100 : on_change 731,change_langage
alpha 732 : top 732,10 : left 732,10 : caption 732,"Langage"
item_add 731,"English"
item_add 731,"Français"
item_add 731,"Deutsch"
button 733 : top 733,130 : left 733,10 : caption 733,"Close" : on_click 733,close_options
command_target_is 0
options_1:
off_error_goto
text 731,item_read$(731,langage%+1)
show 730
to_foreground 730
return
close_options:
hide 730
return
change_langage:
langage% = item_index(731) - 1
caption 62,t$(langage%,0)
caption 63,t$(langage%,1)
caption 64,t$(langage%,2)
caption 65,t$(langage%,3)
caption 67,t$(langage%,4)
caption 70,t$(langage%,5)
caption 71,t$(langage%,6)
caption 72,t$(langage%,7)
caption 74,t$(langage%,8)
caption 11,t$(langage%,1)
caption 12,t$(langage%,2)
caption 13,t$(langage%,3)
caption 14,t$(langage%,7)
caption 15,t$(langage%,4)
caption 31,t$(langage%,11)
caption 32,t$(langage%,12)
caption 33,t$(langage%,13)
caption 40,t$(langage%,14)
caption 50,t$(langage%,15)
2d_target_is 20 : 2d_line 7,5,100,5
print_target_is 20 : print_locate 10,0 : print t$(langage%,10)
return

init_langage:
langage% = 1
t$(0,0) = "Files" : t$(1,0) = "Fichiers" : t$(2,0) = "Dateien"
t$(0,1) = "Load..." : t$(1,1) = "Ouvrir..." : t$(2,1) = "Öffnen..."
t$(0,2) = "Save..." : t$(1,2) = "Enregistrer..." : t$(2,2) = "Speichern..."
t$(0,3) = "Show" : t$(1,3) = "Afficher" : t$(2,3) = "Anschauen"
t$(0,4) = "Exit" : t$(1,4) = "Sortir" : t$(2,4) = "Schliessen"
t$(0,5) = "Help" : t$(1,5) = "Aide" : t$(2,5) = "Hilfe"
t$(0,6) = "Documentation" : t$(1,6) = "Documentation" : t$(2,6) = "Dokumentation"
t$(0,7) = "Options" : t$(1,7) = "Options" : t$(2,7) = "Optionen"
t$(0,8) = "About" : t$(1,8) = "A-propos": t$(2,8) = "Info"
t$(0,9) = "Functions" : t$(1,9) = "Fonctions" : t$(2,9) = "Funktionen"
t$(0,10) = "  Program  " : t$(1,10) = "Programme" : t$(2,10) = "Programm"
t$(0,11) = "Labels" : t$(1,11) = "Labels": t$(2,11) = "Labels"
t$(0,12) = "Dims" : t$(1,12) = "Dims" : t$(2,12) = "Dims"
t$(0,13) = "Code" : t$(1,13) = "Code" : t$(2,13) = "Code"
t$(0,14) = "Events" : t$(1,14) = "Evènements" : t$(2,14) = "Ereignisse"
t$(0,15) = "Subroutines" : t$(1,15) = "Sous-programmes" : t$(2,15) = "Unterprogramme"
t$(0,16) = "No event routine selected !" : t$(1,16) = "Aucune routine évènement sélectionnée !" : t$(2,16) = "Keine Ereignis-Routine gewählt !"
t$(0,17) = "Gosub to subroutine" : t$(1,17) = "Gosub vers sous-programme": t$(2,17) = "Gosub zu einem Unterprogramm"
t$(0,18) = "Routine name:" : t$(1,18) = "Nom du sous-programme" : t$(2,18) = "Name des Unterprogramms"
t$(0,19) = "Invalid call to event routine !" : t$(1,19) = "Appel invalide d'une routine évènement !" : t$(2,19) = "Verbotener Aufruf einer Ereignis-Routine !"
t$(0,20) = "No subroutine selected !" : t$(1,20) = "Aucun sous-programme sélectionné !" : t$(2,20) = "Kein Unterprogramm gewählt !"
t$(0,21) = "Really remove event routine " : t$(1,21) = "Vraiment supprimer la routine évènement " : t$(2,21) = "Wirklich dir Ereignis-Routine löschen: "
t$(0,22) = "Really remove subroutine " : t$(1,22) = "Vraiment supprimer le sous-programme ": t$(2,22) = "Wirklich das Unterprogramm löschen: "
t$(0,23) = "New event" : t$(1,23) = "Nouvel évènement" : t$(2,23) = "Neues Ereignis"
t$(0,24) = "Routine name:" : t$(1,24) = "Nom de la routine" : t$(2,24) = "Name der Routine"
t$(0,25) = "Event routine already exists !" : t$(1,25) = "La routine évènement existe déjà !" : t$(2,25) = "Die Ereignis-Routine besteht schon !"
t$(0,26) = "New subroutine" : t$(1,26) = "Nouveau sous-programme: " : t$(2,26) = "Neues Unterprogramm: "
t$(0,27) = "Subroutine already exists !" : t$(1,27) = "Sous-programme existe déjà !" : t$(2,27) = "Unterprogramm besteht schon !"
t$(0,28) = "File does not exist:" : t$(1,28) = "Fichier inexistant:" : t$(2,28) = "Datei fehlt:"
t$(0,29) = "Not a valid Designer file:" : t$(1,29) = "Ce n'est pas un fichier Designer valide:" : t$(2,29) = "Keine korrekte Designer Datei:"
t$(0,30) = "Do you want to eplace existing file " : t$(1,30) = "Voulez-vous repmlacer le fichier existant " : t$(2,30) = "Wirklich bestehende Datei ersetzen: "
t$(0,31) = "Really quit the Designer ?" : t$(1,31) = "Voulez-vous vraiment sortir du Designer ?" : t$(2,31) = "Wirklich den Designer verlassen ?"
t$(0,32) = "Designer version " : t$(1,32) = "Designer version ": t$(2,32) = "Designer Version "
t$(0,33) = "Author: Klaus" : t$(1,33) = "Auteur: Klaus" : t$(2,33) = "Autor: Klaus"
t$(0,34) = "Creation date: " : t$(1,34) = "Date de création: " : t$(2,34) = "Erstellungsdatum: "
t$(0,35) = "" : t$(1,35) = ""
t$(0,36) = "" : t$(1,36) = ""
t$(0,37) = "" : t$(1,37) = ""
t$(0,38) = "" : t$(1,38) = ""
t$(0,39) = "" : t$(1,39) = ""
' t$(0,4) = "" : t$(1,4) = ""

return

test.bas
Code:
' *** Designer Project ***
' *** test1.bas ***
' *** Designer Labels ***
label ok, textes
label essai
' *** Designer Event Labels ***
Label E1
Label E2
' *** Designer Subroutine Labels ***
Label charger
Label sauver
' *** Designer Dims ***
dim i%, s$
dim b(200)
' *** Designer Application Start Code ***
i% = 1
' *** Designer End of static code ***
End
' *** Designer Event Routine: E1 ***
E1:
s$ = str$(i%)
return
' *** Designer Event Routine: E2 ***
E2:
i% = i% + 1
return
' *** Designer Subroutine: charger ***
charger:
message "charger"
return
' *** Designer Subroutine: sauver ***
sauver:
message "sauver"
return
' *** Designer End of Project ***

EDIT

Version 1.01: ajout de boutons [-] pour supprimer des routines évènements et internes
Version 1.02: ajout de boutons [Call] pour ajouter un GOSUB à un sous-programme interne
Version 1.03: ajout d'un bouton Show pour visualiser le code tel qu'il serait généré par Save
Version 1.04: ajout paramétrage de la langue. Actuellement Anglais, Français et Allemand, Français par défaut


Dernière édition par Klaus le Lun 17 Jan 2011 - 3:02, édité 4 fois
Revenir en haut Aller en bas
http://klauspanoramic.comxa.com/index.html
Klaus

Klaus


Nombre de messages : 12294
Age : 74
Localisation : Ile de France
Date d'inscription : 29/12/2009

Outil de génération d'une structure Panoramic valide Empty
MessageSujet: Re: Outil de génération d'une structure Panoramic valide   Outil de génération d'une structure Panoramic valide EmptyDim 16 Jan 2011 - 18:33

Le post précédent contient Designer.bas mis à jour en version 1.03. Il y a les améliorations suivantes:
Version 1.01: ajout de boutons [-] pour supprimer des routines évènements et internes
Version 1.02: ajout de boutons [Call] pour ajouter un GOSUB à un sous-programme interne
Version 1.03: ajout d'un bouton Show pour visualiser le code tel qu'il serait généré par Save

La version 1.02 apporte en particulier un encadrement pour les restrictions conseillées pour les appels des sous-programmes. En effet, une routine évèmenemt peut appeler un sous-programme interne. Mais ni une routine évènement ni un sous-programme interne ne devraient appeler une routine évènement ! Ceci est contrôlé et bloqué par le programme, le cas échéant. Si l'on déclare l'appel d'un sous-programme interne qui n'existe pas encore, il est ajouté à la liste et son squelette est créé.

En particulier pour les nouveaux Panoramciens, je conseille l'utilisation de ce programme pour générer une structure de base valide. Cette structure pourra ensuite être modifiée librement. Et si l'on ne touche pas aux commentaires générés ni à leur agencement (ordre dans le programme), on pourra même recharger un programme modifié comme projet Designer pour en étendre la structure...

Voici d'ailleurs le programme de test de flood_fill que j'ai mis en ligne dans un autre fil de discussion, repris avec Designer. On peut le charger par Designer, le sauvegarder, l'exécuter. J' l'ai appelé TestCouleur.bas:
Code:
' *** Designer Project ***
' *** test1.bas ***
' *** Designer Labels ***
' *** Designer Event Labels ***
label cadre
label interieur
' *** Designer Subroutine Labels ***
' *** Designer Dims ***
dim c_cadre%(3),c_interieur%(3),c%(3),i%
' *** Designer Application Start Code ***
form 1: top 1,100 : left 1,100

button 2 : parent 2,1 : top 2,10 : left 2,200 : caption 2,"Cadre"
button 3 : parent 3,1 : top 3,40 : left 3,200 : caption 3,"intérieur"
on_click 2,cadre
on_click 3,interieur

c_cadre%(1) = 255
c_interieur%(3) = 255
2d_target_is 1
2d_pen_width 20
2d_pen_color c_cadre%(1),c_cadre%(2),c_cadre%(3)
2d_fill_color c_interieur%(1),c_interieur%(2),c_interieur%(3)

2d_rectangle 30,30,120,120

' *** Designer End of static code ***
End
' *** Designer Event Routine: cadre ***
cadre:
for i%=1 to 3
    repeat
        c%(i%) = int(rnd(1)*255)
    until (c%(i%)<>c_cadre%(i%)) and (c%(i%)<>c_interieur%(i%))
    c_cadre%(i%) = c%(i%)
next i%
2d_flood 35,35,c%(1),c%(2),c%(3)
return
' *** Designer Event Routine: interieur ***
interieur:
for i%=1 to 3
    repeat
        c%(i%) = int(rnd(1)*255)
    until (c%(i%)<>c_cadre%(i%)) and (c%(i%)<>c_interieur%(i%))
    c_interieur%(i%) = c%(i%)
next i%
2d_flood 55,55,c%(1),c%(2),c%(3)
return
' *** Designer Subroutine: charger ***
' *** Designer Subroutine: sauver ***
' *** Designer End of Project ***
Revenir en haut Aller en bas
http://klauspanoramic.comxa.com/index.html
Invité
Invité




Outil de génération d'une structure Panoramic valide Empty
MessageSujet: Re: Outil de génération d'une structure Panoramic valide   Outil de génération d'une structure Panoramic valide EmptyDim 16 Jan 2011 - 19:13

C'est bien.
Très certainement il peut-être amélioré, mais ce n'est pas pour faire un programme automatique.

Le problème maintenant est qu'il reste en tête des programmes, pour ne pas qu'il soit enfui dans la masse, donc à ce moment là: inutile.

Personnellement je pense qu'il faudrait en rajouter pour l'aide, qui me parait trop succincte pour un novice qui découvre ce langage. J'avoue que des mots comme Events ne m'aurait rien dit il y a quelques temps, même si j'étais capable de faire un programme.
Revenir en haut Aller en bas
Klaus

Klaus


Nombre de messages : 12294
Age : 74
Localisation : Ile de France
Date d'inscription : 29/12/2009

Outil de génération d'une structure Panoramic valide Empty
MessageSujet: Re: Outil de génération d'une structure Panoramic valide   Outil de génération d'une structure Panoramic valide EmptyDim 16 Jan 2011 - 22:39

Oui, j'ai mis l'interface visuel en anglais, cette fois. Je réfléchis à une façon intelligente de le rendre multi-lingue, et je le remettrai en ligne avec un choix de la langue, tel que c'est le cas pour beaucoup de programmes. L'aide devra également être amélioré, je suis d'accord.
Revenir en haut Aller en bas
http://klauspanoramic.comxa.com/index.html
Yannick




Nombre de messages : 8610
Age : 53
Localisation : Bretagne
Date d'inscription : 15/02/2010

Outil de génération d'une structure Panoramic valide Empty
MessageSujet: multilingue   Outil de génération d'une structure Panoramic valide EmptyDim 16 Jan 2011 - 22:49

J' ai jeté un oeil sur certain log et je pense que certains
créent des variables de menu string et initialise les captions des menus avec ces variables
ainsi dans le menu paramètre tu as une langue par default et si tu clique sur une langue le log charge un fichier
et initialise les variables dans la langue choisie.

si tu passes par un list qui recherche les fichiers existants par la suite il te suffit de rajouter un fichier de traduit
le log le prendra dans sa liste.

Je sais que tu le peux.....
(...mais je ne suis pas sur que tu le veuilles)



lol!
Revenir en haut Aller en bas
Klaus

Klaus


Nombre de messages : 12294
Age : 74
Localisation : Ile de France
Date d'inscription : 29/12/2009

Outil de génération d'une structure Panoramic valide Empty
MessageSujet: Re: Outil de génération d'une structure Panoramic valide   Outil de génération d'une structure Panoramic valide EmptyLun 17 Jan 2011 - 2:14

Ca y est - version V1.04 en multi-langage ! Pour le moment, Anglais et Français !
Revenir en haut Aller en bas
http://klauspanoramic.comxa.com/index.html
Yannick




Nombre de messages : 8610
Age : 53
Localisation : Bretagne
Date d'inscription : 15/02/2010

Outil de génération d'une structure Panoramic valide Empty
MessageSujet: je le savais   Outil de génération d'une structure Panoramic valide EmptyLun 17 Jan 2011 - 2:35

Je le savais que tu pouvais le faire....
....c'est juste une question de volonté mais bon
à coeur vaillant, rien n'est impossible

cheers
Revenir en haut Aller en bas
Klaus

Klaus


Nombre de messages : 12294
Age : 74
Localisation : Ile de France
Date d'inscription : 29/12/2009

Outil de génération d'une structure Panoramic valide Empty
MessageSujet: Re: Outil de génération d'une structure Panoramic valide   Outil de génération d'une structure Panoramic valide EmptyLun 17 Jan 2011 - 3:04

Et toujours plus fort: ajout de l'Allemand comme langue ! Severin, ça t'intéresse ?

Und noch besser: Deutsch ist auch als sprache hinzugekommen ! Severin, interressiert Dich das ?

EDIT

J'ai mis mon programme en ligne sur mon site (voir le nouveau fil de discussion sur "Le site de Klaus". Je poursuivrai la discussion concernant ce programme dans ce fil de discussion:
https://panoramic.1fr1.net/t1385-utilitaire-designer-generer-une-structure-panoramic-valide
et je ferme donc la discussion ici !
Revenir en haut Aller en bas
http://klauspanoramic.comxa.com/index.html
Contenu sponsorisé





Outil de génération d'une structure Panoramic valide Empty
MessageSujet: Re: Outil de génération d'une structure Panoramic valide   Outil de génération d'une structure Panoramic valide Empty

Revenir en haut Aller en bas
 
Outil de génération d'une structure Panoramic valide
Revenir en haut 
Page 1 sur 1
 Sujets similaires
-
» Nouvel outil de mise à disposition de sources Panoramic
» [AIDE] Génération de l'aide Panoramic en format html
» Structure des variables en Panoramic
» [Résolu] problème de structure de Panoramic
» Discussion sur la nouvelle structure d'un source PANORAMIC

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
FORUM DE DISCUSSION SUR LE LANGAGE PANORAMIC :: PANORAMIC :: Vos sources, vos utilitaires à partager-
Sauter vers: