Yannick
Nombre de messages : 8610 Age : 53 Localisation : Bretagne Date d'inscription : 15/02/2010
| Sujet: re Mar 8 Oct 2019 - 13:54 | |
| @ Jack, Pour une commande qui n'existe pas elle est vachement opérationnelle et pratique. Ele m' a fait faire de très grosses économies de lignes de code. - Code:
-
' MINI EDITOR ' VS 0.1 ' Y.GERONIMI ' OCTOBRE 2019 ' Indenté pour NotePad++ ' ===================================================================================== ' VARIABLES ' ===================================================================================== ' incrémentation des boucles hors procédures DIM z% ' position d'objets DIM py% DIM px% ' Gestion des étiquettes DIM capt$ DIM etiq$ ' Incrémentation des numéros d'objets DIM no% ' Gestion des objets synedit DIM SynEtat%(20) DIM ACTIVENUM% ' ===================================================================================== ' CONSTANTES ENVIRONNEMENT ' ===================================================================================== ' Chemins des dossiers DIM Path$ DIM PathFile$ DIM PathIcoIn$ DIM PathIcoOut$ ' Chemins des fichiers DIM ParamFile$ :' Fichier paramètres DIM MenuIcoOut$(30) :' Icones non survolées DIM MenuIcoIn$(30) :' Icones survolées ' ===================================================================================== ' CONSTANTES - OBJETS ' ===================================================================================== ' Fichiers en lecture / écriture DIM F_or% DIM F_ow% ' Boites de dialogue DIM Odial% DIM Sdial% ' Objets form 0 DIM Frame%(5) ' main menu DIM MM% DIM SM%(50) ' picure button DIM PictBtnMenu%(30) ' tableur DIM Classeur% DIM Feuil%(20) DIM Syn%(20) ' ===================================================================================== ' CONSTANTES PARAMETRES ' ===================================================================================== ' Gouttière DIM ParGutView% :' Hide 0 / Show 1 DIM ParGutColR%,ParGutColG%,ParGutColB% :' Couleur de gouttière DIM ParGutPol$ :' Police de la gouttière DIM ParGutPolAtt$ :' Attibuts de police BIUS DIM ParFtGutColR%,ParFtGutColG%,ParFtGutColB% :' Couleur de police de la gouttière ' Objet DIM ParObjColR%,ParObjColG%,ParObjColB% :' Couleur de synedit DIM ParObjPol$ :' Police de synedit DIM ParObjPolAtt$ :' Attrivbuts de police BIUS DIM ParFtObjColR%,ParFtObjColG%,ParFtObjColB% :' Couleur de police ' Mots clefs DIM ParKeyPolAtt$ :' Attrivbuts de police BIUS DIM ParFtKeyColR%,ParFtKeyColG%,ParFtKeyColB% :' Couleur de police ' Commentaires DIM ParComPolAtt$ :' Attrivbuts de police BIUS DIM ParFtComColR%,ParFtComColG%,ParFtComColB% :' Couleur de police ' Texte DIM ParTxtPolAtt$ :' Attrivbuts de police BIUS DIM ParFtTxtColR%,ParFtTxtColG%,ParFtTxtColB% :' Couleur de police ' ===================================================================================== ' LABELS ' ===================================================================================== LABEL CLIC_MAINMENU LABEL CLIC_PICTMENU LABEL CLIC_OTHERS LABEL CHANGE LABEL DCLIC LABEL MMFRAME LABEL MMBTN LABEL SHOWFEUIL ' ===================================================================================== ' PROGRAMME PRINCIPAL ' ===================================================================================== APPLICATION_TITLE "MINI EDITOR - Vs 0.1" INIT_ENVIRONNEMENT() INIT_OBJECTS() INIT_PARAMETERS() ' format du form 0 FORMAT_FORM0(600,1000) ' Création du Main_menu Main_menu MM% etiq$ = "Fichier,Edition,Exécuter,Réglages,A Propos,Aide," for z%=1 to 6 capt$ = left$(etiq$,instr(etiq$,chr$(44))-1) etiq$ = right$(etiq$,len(etiq$)-instr(etiq$,chr$(44))) if z%=5 CREATE_SUBMENU(z%,MM%,capt$,1) else CREATE_SUBMENU(z%,MM%,capt$,0) end_if next z% etiq$ = "Nouveau,Ouvrir,Fermer,-,Enregistrer,-,Imprimer,-,Quitter," for z%=7 to 15 capt$ = left$(etiq$,instr(etiq$,chr$(44))-1) etiq$ = right$(etiq$,len(etiq$)-instr(etiq$,chr$(44))) CREATE_SUBMENU(z%,SM%(1),capt$,1) next z% etiq$ = "Annuler,Refaire,-,Couper,Copier,Coller,-,Rechercher,Remplacer,-,N° Ligne Yes/No,-,Indentation +,Indentation -," for z%=16 to 29 capt$ = left$(etiq$,instr(etiq$,chr$(44))-1) etiq$ = right$(etiq$,len(etiq$)-instr(etiq$,chr$(44))) CREATE_SUBMENU(z%,SM%(2),capt$,1) next z% etiq$ = "Aperçu,-,Créer un exécutable,Créer une Application,-,Compiler," for z%=30 to 35 capt$ = left$(etiq$,instr(etiq$,chr$(44))-1) etiq$ = right$(etiq$,len(etiq$)-instr(etiq$,chr$(44))) CREATE_SUBMENU(z%,SM%(3),capt$,1) next z% etiq$ = "Skin,Syntax," for z%=36 to 37 capt$ = left$(etiq$,instr(etiq$,chr$(44))-1) etiq$ = right$(etiq$,len(etiq$)-instr(etiq$,chr$(44))) CREATE_SUBMENU(z%,SM%(4),capt$,1) next z% etiq$ = "Aide Mini Editor,Aide Panoramic,Aide KGF.dll," for z%=38 to 40 capt$ = left$(etiq$,instr(etiq$,chr$(44))-1) etiq$ = right$(etiq$,len(etiq$)-instr(etiq$,chr$(44))) CREATE_SUBMENU(z%,SM%(6),capt$,1) next z% ' Création des frames CREATE_FRAME(Frame%(0),height_client(0),width_client(0),0,0,120,120,120) :' Fond CREATE_FRAME(Frame%(1),28,width_client(0),1,0,240,240,240) :' Frame haut CREATE_FRAME(Frame%(2),height_client(0)-26-28-3,42,30,0,240,240,240) :' Frame gauche CREATE_FRAME(Frame%(3),26,width_client(0),height_client(0)-26,0,240,240,240) :' Frame bas ' Création du picture_menu etiq$ = "Nouveau,Ouvrir,Fermer,Enregistrer,Imprimer," etiq$ = etiq$ + "Rechercher,remplacer,Couper,Copier,Coller,Annuler,Refaire,Lignes Num,Indentation +,Indentation -," etiq$ = etiq$ + "Aperçu," py% = top(Frame%(1))+2 px% = left(Frame%(1))+5 for z% = 1 to 16 capt$ = left$(etiq$,instr(etiq$,chr$(44))-1) etiq$ = right$(etiq$,len(etiq$)-instr(etiq$,chr$(44))) CREATE_PICTUREBUTTON(PictBtnMenu%(z%),py%,px%,MenuIcoOut$(z%),capt$) if z%=3 or z%=4 or z%=5 or z%=7 or z%=10 or z%=12 or z%=15 2d_target_is Frame%(1) 2d_pen_color 120,120,130 2d_pen_dot 2d_line px%+35,py%+4,px%+35,py%+20 px% = px%+19 end_if px% = px%+29 next z% ' Activation de l'animation du Picture_menu ACTIVE_BUTTONANIMATION() END ' ===================================================================================== ' SOUS PROGRAMMES - CLIC ' ===================================================================================== CLIC_MAINMENU: ' MENU FICHIER ' NEW if number_click = SM%(7) CREATE_FEUILLE(NumLibre%()) end_if ' OPEN if number_click = SM%(8) end_if ' CLOSE if number_click = SM%(9) end_if ' SAVE if number_click = SM%(11) end_if ' PRINT if number_click = SM%(13) end_if ' SEARCH if number_click = SM%(15) end_if ' ----------------------- ' MENU EDITION ' UNDO if number_click = SM%(16) end_if ' REDO if number_click = SM%(17) end_if ' ---- ' CUT if number_click = SM%(19) end_if ' COPY if number_click = SM%(20) end_if ' PASTE if number_click = SM%(21) end_if ' ---- ' SEARCH if number_click = SM%(23) end_if ' REPLACE if number_click = SM%(24) end_if ' ---- ' LINES if number_click = SM%(26) end_if ' ---- ' INDENT if number_click = SM%(28) end_if ' UNINDENT if number_click = SM%(29) end_if ' ----------------------- ' MENU EXECUTER ' PREVIEW if number_click = SM%(30) end_if ' ---- ' MAKE EXE if number_click = SM%(32) end_if ' MAKE APP if number_click = SM%(33) end_if ' ---- ' COMPILE if number_click = SM%(35) end_if ' ----------------------- ' MENU REGLAGES ' SKIN if number_click = SM%(36) end_if ' SYNTAX if number_click = SM%(37) end_if ' ----------------------- ' MENU A PROPOS ' A PROPOS if number_click = SM%(5) end_if ' ----------------------- ' MENU AIDES ' AIDE MINI EDITOR if number_click = SM%(38) end_if ' AIDE PANORAMIC if number_click = SM%(39) end_if ' AIDE KGF if number_click = SM%(40) end_if RETURN ' ------------------------------------------------------------------------------------- CLIC_PICTMENU: ' NEW if number_click = PictBtnMenu%(1) CREATE_FEUILLE(NumLibre%()) end_if ' OPEN if number_click = PictBtnMenu%(2) end_if ' CLOSE if number_click = PictBtnMenu%(3) end_if ' SAVE if number_click = PictBtnMenu%(4) end_if ' PRINT if number_click = PictBtnMenu%(5) end_if ' SEARCH if number_click = PictBtnMenu%(6) end_if ' REPLACE if number_click = PictBtnMenu%(7) end_if ' CUT if number_click = PictBtnMenu%(8) end_if ' COPY if number_click = PictBtnMenu%(9) end_if ' PASTE if number_click = PictBtnMenu%(10) end_if ' UNDO if number_click = PictBtnMenu%(11) end_if ' REDO if number_click = PictBtnMenu%(12) end_if ' LINES if number_click = PictBtnMenu%(13) end_if ' INDENT if number_click = PictBtnMenu%(14) end_if ' UNINDENT if number_click = PictBtnMenu%(15) end_if ' PREVIEW if number_click = PictBtnMenu%(16) end_if RETURN ' ------------------------------------------------------------------------------------- CLIC_OTHERS: RETURN ' ===================================================================================== ' SOUS PROGRAMMES - CHANGE ' ===================================================================================== CHANGE: RETURN ' ===================================================================================== ' SOUS PROGRAMMES - DCLIC ' ===================================================================================== DCLIC: RETURN ' ===================================================================================== ' SOUS PROGRAMMES - MOUSE_MOVE ' ===================================================================================== MMFRAME: MMFRAME_ANIMATION() RETURN ' ------------------------------------------------------------------------------------- MMBTN: MMBTN_ANIMATION() RETURN ' ===================================================================================== ' SOUS PROGRAMMES - ON_SHOW ' ===================================================================================== SHOWFEUIL: for z%=1 to 20 if number_show = Feuil%(z%) ACTIVENUM% = z% exit_for end_if next z% RETURN ' ===================================================================================== ' PROCEDURES - INITIALISATIONS ' ===================================================================================== SUB INIT_ENVIRONNEMENT() DIM_local i% ' Chemins des dossiers Path$ = file_extract_path$(param_value$(0)) PathFile$ = Path$+"Files" PathIcoIn$ = PathFile$+"IcoIn" PathIcoOut$ = PathFile$+"IcoOut" ' Chemins des fichiers ParamFile$ = PathFile$+"Param.ini" :' Fichier paramètres for i% = 1 to 20 : MenuIcoOut$(i%) = PathIcoOut$+"Menu_1"+right$("00"+str$(i%),2)+".bmp" : next i% :' Icones non survolées for i% = 1 to 20 : MenuIcoIn$(i%) = PathIcoIn$+"Menu_2"+right$("00"+str$(i%),2)+".bmp" : next i% :' Icones survolées END_SUB ' ------------------------------------------------------------------------------------- SUB INIT_OBJECTS() DIM_local i% ' Fichiers en lecture / écriture no% = no%+1 : F_or% = no% no% = no%+1 : F_ow% = no% ' Boites de dialogue no% = no%+1 : Odial% = no% no% = no%+1 : Sdial% = no% ' Objets du form 0 for i% = 0 to 5 : no% = no%+1 : Frame%(i%) = no% : next i% no% = no%+1 : MM% = no% for i% = 1 to 50 : no% = no%+1 : SM%(i%) = no% : next i% for i% = 1 to 30 : no% = no%+1 : PictBtnMenu%(i%) = no% : next i% no% = no%+1 : Classeur% = no% for i% = 1 to 20 : no% = no%+1 : Feuil%(i%) = no% : next i% for i% = 1 to 20 : no% = no%+1 : Syn%(i%) = no% : next i% END_SUB ' ------------------------------------------------------------------------------------- SUB INIT_PARAMETERS() file_open_read F_or%,ParamFile$ ' Gouttière ' Hide 0 / Show 1 ParGutView% = val(file_readln$(F_or%)) ' Couleur de gouttière ParGutColR% = val(file_readln$(F_or%)) ParGutColG% = val(file_readln$(F_or%)) ParGutColB% = val(file_readln$(F_or%)) ' Police de la gouttière ParGutPol$ = file_readln$(F_or%) ' Attibuts de police BIUS ParGutPolAtt$ = file_readln$(F_or%) ' Couleur de police de la gouttière ParFtGutColR% = val(file_readln$(F_or%)) ParFtGutColG% = val(file_readln$(F_or%)) ParFtGutColB% = val(file_readln$(F_or%)) ' Objet ' Couleur de synedit ParObjColR% = val(file_readln$(F_or%)) ParObjColG% = val(file_readln$(F_or%)) ParObjColB% = val(file_readln$(F_or%)) ' Police de synedit ParObjPol$ = file_readln$(F_or%) ' Attrivbuts de police BIUS ParObjPolAtt$ = file_readln$(F_or%) ' Couleur de police ParFtObjColR% = val(file_readln$(F_or%)) ParFtObjColG% = val(file_readln$(F_or%)) ParFtObjColB% = val(file_readln$(F_or%)) ' Mots clefs ' Attrivbuts de police BIUS ParKeyPolAtt$ = file_readln$(F_or%) ' Couleur de police ParFtKeyColR% = val(file_readln$(F_or%)) ParFtKeyColG% = val(file_readln$(F_or%)) ParFtKeyColB% = val(file_readln$(F_or%)) ' Commentaires ' Attrivbuts de police BIUS ParComPolAtt$ = file_readln$(F_or%) ' Couleur de police ParFtComColR% = val(file_readln$(F_or%)) ParFtComColG% = val(file_readln$(F_or%)) ParFtComColB% = val(file_readln$(F_or%)) ' Texte ' Attrivbuts de police BIUS ParTxtPolAtt$ = file_readln$(F_or%) ' Couleur de police ParFtTxtColR% = val(file_readln$(F_or%)) ParFtTxtColG% = val(file_readln$(F_or%)) ParFtTxtColB% = val(file_readln$(F_or%)) file_close F_or% END_SUB ' ===================================================================================== ' PROCEDURES - INTERFACE ' ===================================================================================== SUB FORMAT_FORM0(h%,w%) height 0,h% width 0,w% top 0,(screen_y-height(0))/2 left 0,(screen_x-width(0))/2 color 0,240,240,240 font_name 0,"Courier new" :font_size 0,10 : font_bold 0 font_color 0,120,120,130 caption 0,"MINI EDITOR - Vs 0.1" END_SUB ' ------------------------------------------------------------------------------------- SUB CREATE_FRAME(obj%,h%,w%,t%,l%,bgR%,bgG%,bgB%) picture obj% height obj%,h% width obj%,w% top obj%,t% left obj%,l% color obj%,bgR%,bgG%,bgB% END_SUB ' ------------------------------------------------------------------------------------- SUB CREATE_SUBMENU(n%,p%,c$,cl%) sub_menu SM%(n%) : parent SM%(n%),p% : caption SM%(n%),c$ if cl%=1 on_click SM%(n%),CLIC_MAINMENU end_if END_SUB ' ------------------------------------------------------------------------------------- SUB CREATE_FEUILLE(n%) dim_local i%,Mess%,txt$ if n%>0 if object_exists(Classeur%)=0 container_tab Classeur% top Classeur%,top(Frame%(1))+height(Frame%(1))+5 left Classeur%,left(Frame%(2))+width(Frame%(2))+5 height Classeur%,height(Frame%(2))-10 width Classeur%,width_client(0)-width(Frame%(2))-10 end_if tab Feuil%(n%) parent Feuil%(n%),Classeur% caption Feuil%(n%),"Nouveau_"+str$(n%)+".bas" Synedit Syn%(n%) parent Syn%(n%),Feuil%(n%) height Syn%(n%),height_client(Classeur%)-40 width Syn%(n%),width_client(Classeur%)-15 top Syn%(n%),5 left Syn%(n%),5 Synedit_target_is_gutter color Syn%(n%),ParGutColR%,ParGutColG%,ParGutColB% font_name Syn%(n%),ParGutPol$ font_color Syn%(n%),ParFtGutColR%,ParFtGutColG%,ParFtGutColB% if val(mid$(ParGutPolAtt$,1,1))=1 : font_bold Syn%(n%) : end_if if val(mid$(ParGutPolAtt$,2,1))=1 : font_italic Syn%(n%) : end_if if val(mid$(ParGutPolAtt$,3,1))=1 : font_underline Syn%(n%) : end_if if val(mid$(ParGutPolAtt$,4,1))=1 : font_strike Syn%(n%) : end_if
Synedit_target_is_object color Syn%(n%),ParObjColR%,ParObjColG%,ParObjColB% font_name Syn%(n%),ParObjPol$ font_color Syn%(n%),ParFtObjColR%,ParFtObjColG%,ParFtObjColB% if val(mid$(ParObjPolAtt$,1,1))=1 : font_bold Syn%(n%) : end_if if val(mid$(ParObjPolAtt$,2,1))=1 : font_italic Syn%(n%) : end_if if val(mid$(ParObjPolAtt$,3,1))=1 : font_underline Syn%(n%) : end_if if val(mid$(ParObjPolAtt$,4,1))=1 : font_strike Syn%(n%) : end_if Synedit_target_is_keyword font_color Syn%(n%),ParFtKeyColR%,ParFtKeyColG%,ParFtKeyColB% if val(mid$(ParKeyPolAtt$,1,1))=1 : font_bold Syn%(n%) : end_if if val(mid$(ParKeyPolAtt$,2,1))=1 : font_italic Syn%(n%) : end_if if val(mid$(ParKeyPolAtt$,3,1))=1 : font_underline Syn%(n%) : end_if if val(mid$(ParKeyPolAtt$,4,1))=1 : font_strike Syn%(n%) : end_if
Synedit_target_is_comment font_color Syn%(n%),ParFtComColR%,ParFtComColG%,ParFtComColB% if val(mid$(ParComPolAtt$,1,1))=1 : font_bold Syn%(n%) : end_if if val(mid$(ParComPolAtt$,2,1))=1 : font_italic Syn%(n%) : end_if if val(mid$(ParComPolAtt$,3,1))=1 : font_underline Syn%(n%) : end_if if val(mid$(ParComPolAtt$,4,1))=1 : font_strike Syn%(n%) : end_if Synedit_target_is_string font_color Syn%(n%),ParFtTxtColR%,ParFtTxtColG%,ParFtTxtColB% if val(mid$(ParTxtPolAtt$,1,1))=1 : font_bold Syn%(n%) : end_if if val(mid$(ParTxtPolAtt$,2,1))=1 : font_italic Syn%(n%) : end_if if val(mid$(ParTxtPolAtt$,3,1))=1 : font_underline Syn%(n%) : end_if if val(mid$(ParTxtPolAtt$,4,1))=1 : font_strike Syn%(n%) : end_if
on_show Feuil%(i%),SHOWFEUIL else txt$ = "Aucun emplacement libre !"+chr$(13) txt$ = txt$+"La limite de 20 fichiers ouvert est atteinte."+chr$(13) txt$ = txt$+"Vous devez fermer un onglet." Mess% = message_warning_ok(txt$) end_if END_SUB ' ------------------------------------------------------------------------------------- SUB CREATE_PICTUREBUTTON(obj%,t%,l%,Img$,ht$) picture obj% height obj%,24 width obj%,24 top obj%,t% left obj%,l% file_load obj%,Img$ hint obj%,ht$ cursor_point obj% on_click obj%,CLIC_PICTMENU END_SUB ' ------------------------------------------------------------------------------------- SUB ACTIVE_BUTTONANIMATION() on_mouse_move Frame%(1),MMFRAME END_SUB ' ------------------------------------------------------------------------------------- SUB MMFRAME_ANIMATION() dim_local i% off_mouse_move number_mouse_move if number_mouse_move = Frame%(1) for i% = 1 to 16 file_load PictBtnMenu%(i%),MenuIcoOut$(i%) on_mouse_move PictBtnMenu%(i%),MMBTN next i% end_if END_SUB ' ------------------------------------------------------------------------------------- SUB MMBTN_ANIMATION() dim_local i% off_mouse_move number_mouse_move if number_mouse_move > (PictBtnMenu%(1)-1) and number_mouse_move < (PictBtnMenu%(20)+1) for i% = 1 to 16 if number_mouse_move = PictBtnMenu%(i%) file_load PictBtnMenu%(i%),MenuIcoIn$(i%) exit_for end_if next i% on_mouse_move Frame%(1),MMFRAME end_if END_SUB ' ===================================================================================== ' PROCEDURES - PROGRAMME ' =====================================================================================
' ===================================================================================== ' FONCTIONS ' ===================================================================================== FNC NumLibre%() dim_local i% for i%=1 to 20 if SynEtat%(i%)=0 result i% SynEtat%(i%)=1 exit_for else result 0 end_if next i% END_FNC
Je vais mettre dans quelques secondes un zip sur mon webdav. Source + *.exe obtenu avec Make_exe.exe Vs 0.9.29i8 du 18/04/2019 Si Panoramic invente ses propres fonctions tout seul... Où ton clone travail pour toi, ou pire, tu as des soucis de somnombulisme... Ca y est MiniEditor.zip est sur mon webdav. Il s' agit de l'animation de la barre Picture_menu. Pas d'emballement de tous c'est une ébauche. Oups... Jack... ton inconscient a aussi fait NUMBER_MOUSE_DOWN (même si je ne l'utilise pas dans ce source) | |
|