-
Notifications
You must be signed in to change notification settings - Fork 0
/
_partition_widget.asm
executable file
·3161 lines (2101 loc) · 71.2 KB
/
_partition_widget.asm
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
COMMENT &
onaip -- piano software
Copyright (C) 2015-2022 Chédotal Julien
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING . If not, write to the
Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Please send bugreports with examples or suggestions to rjdi@wanadoo.fr
&
INCLUDE inc\onaip.inc
.data
partition_widget_class_name byte "partition_widget_class", 0
scrollbar_widget_class_name byte "ScrollBar", 0
clef_fa_rsrc byte "CLEF_FA", 0
clef_sol_rsrc byte "CLEF_SOL", 0
accolade_rsrc byte "ACCOLADE", 0
diese_rsrc byte "DIESE", 0
bemol_rsrc byte "BEMOL", 0
ErrMsgGrave byte "Erreur grave, le programme va se fermer", 0
ErrMsgPartition byte "Impossible d'allouer la mémoire pour l'affichage de la partition !", 0
ErrMsgMemoire byte "Erreur d'allocation de mémoire pour les notes !", 0
ErrMsgBitmap byte "Impossible de charger les ressources graphique !", 0
ptwi partition_widget_infos <> ; une seule instance du widget à gérer
; tableau pour le traçage des lignes supplémentaires pour la clef de sol
ligne_sup_clef_sol_index_max dword 36
ligne_sup_clef_sol dword OUI,
NOTE_HORS_PORTEE,
OUI,
NOTE_HORS_PORTEE,
OUI,
NOTE_HORS_PORTEE,
OUI,
NOTE_HORS_PORTEE,
OUI,
NOTE_HORS_PORTEE,
OUI,
NOTE_HORS_PORTEE,
OUI,
NOTE_HORS_PORTEE,
OUI,
NOTE_HORS_PORTEE,
OUI
ligne_sup_clef_sol_ dword NON,
NON, ; LIGNE 5 PORTEE
NON,
NON, ; LIGNE 4 PORTEE
NON,
NON, ; LIGNE 3 PORTEE
NON,
NON, ; LIGNE 2 PORTEE (SOL)
NON,
NON, ; LIGNE 1 PORTEE
NON,
OUI,
NOTE_HORS_PORTEE,
OUI,
NOTE_HORS_PORTEE,
OUI,
NOTE_HORS_PORTEE,
OUI,
NOTE_HORS_PORTEE
; tableau pour le traçage des lignes supplémentaires pour la clef de fa
ligne_sup_clef_fa_index_max dword 30
ligne_sup_clef_fa dword OUI,
NOTE_HORS_PORTEE,
OUI,
NOTE_HORS_PORTEE,
OUI,
NOTE_HORS_PORTEE,
OUI,
NON,
NON, ; LIGNE 5 PORTEE
NON,
NON, ; LIGNE 4 PORTEE (FA)
NON,
NON, ; LIGNE 3 PORTEE
NON,
NON, ; LIGNE 2 PORTEE
NON,
NON ; LIGNE 1 PORTEE
ligne_sup_clef_fa_ dword NON,
OUI,
NOTE_HORS_PORTEE,
OUI,
NOTE_HORS_PORTEE,
OUI,
NOTE_HORS_PORTEE,
OUI,
NOTE_HORS_PORTEE,
OUI,
NOTE_HORS_PORTEE,
OUI,
NOTE_HORS_PORTEE
.data?
; pointeur mémoire globalalloc
notes_infos_portee_haute dword ?
notes_infos_portee_basse dword ?
.code
; **************************************************************************
partition_widget_class_register proc
LOCAL wc:WNDCLASSEX
LOCAL msg:MSG
LOCAL hwnd:HWND
LOCAL lb:LOGBRUSH
LOCAL hbrush:dword
mov wc.cbSize, sizeof WNDCLASSEX
mov wc.style, CS_HREDRAW or CS_VREDRAW ;or WS_VSCROLL or WS_HSCROLL
mov wc.lpfnWndProc, offset partition_widget_proc
mov wc.cbClsExtra, NULL
mov wc.cbWndExtra, NULL
invoke GetModuleHandle, NULL
push eax
pop wc.hInstance
; créer un pinceau blanc
mov lb.lbStyle, BS_SOLID
mov lb.lbColor, 0FFFFFFh
mov lb.lbHatch, HS_VERTICAL
invoke CreateBrushIndirect, addr lb
mov hbrush, eax
mov wc.hbrBackground, eax
mov wc.lpszMenuName, NULL
mov wc.lpszClassName, offset partition_widget_class_name
invoke LoadIcon, NULL, IDI_APPLICATION
mov wc.hIcon, 0
mov wc.hIconSm, 0
invoke LoadCursor, NULL, IDC_ARROW
mov wc.hCursor, eax
; on enregistre la classe de la fenêtre
invoke RegisterClassEx, addr wc
; eax = 0 alors erreur
push eax
invoke DeleteObject, hbrush
; RegisterClassEx -> eax
pop eax
ret
partition_widget_class_register endp
; ***************************************************************************
partition_widget_proc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
.IF uMsg == WM_DESTROY
; libére les resources
invoke DeleteDC, ptwi.hdc_zoom_x1
invoke DeleteObject, ptwi.hbitmap_zoom_x1
invoke DeleteObject, ptwi.h_bitmap_clef_fa
invoke DeleteObject, ptwi.h_bitmap_clef_sol
invoke DeleteObject, ptwi.h_bitmap_accolade
invoke DeleteObject, ptwi.h_bitmap_diese
invoke DeleteObject, ptwi.h_bitmap_bemol
invoke GlobalFree, notes_infos_portee_haute
invoke PostQuitMessage, NULL
.ELSEIF uMsg == WM_CREATE
mov eax, hWnd
mov ptwi.hwnd, eax
invoke partition_widget_init
; ***********************
.ELSEIF uMsg == WM_PAINT
invoke partition_widget_dessine_partition
.ELSEIF uMsg == WM_SIZE
invoke partition_widget_resize
.ELSEIF uMsg == WM_HSCROLL || uMsg == WM_VSCROLL
invoke partition_widget_scrollbar, wParam, lParam
; utile pour supprimer le son "bell" à l'appuie d'une touche quand la fenêtre à le focus
.ELSEIF uMsg == WM_GETDLGCODE
mov eax, DLGC_WANTALLKEYS
ret
; ********************************************
; la roulette de la souris pour le zoom -/+
.ELSEIF uMsg == WM_MOUSEWHEEL
invoke partition_widget_roulette_souris, wParam, lParam
ret
.ELSEIF uMsg == WM_KEYUP
; gestion du clavier
mov eax, wParam
; touche +
.if eax == VK_ADD
; augmenter de 10 % la taille de la partition
invoke partition_widget_zoom, 10, ZOOM_PLUS
ret
; touche -
.elseif eax == VK_SUBTRACT
; réduire de 10 % la taille de la partition
invoke partition_widget_zoom, 10, ZOOM_MOINS
ret
.endif
mov eax, 1
ret
; ******************************************************
.ELSEIF uMsg == WM_LBUTTONDOWN
; enregistre la position de départ de la souris lors du click gauche, pour le scrolling
mov eax, lParam
mov edx, eax
and eax, 0FFFFh ; x
shr edx, 16 ; y
mov ptwi.click_gauche_souris_x, eax
mov ptwi.click_gauche_souris_y, edx
ret
.ELSEIF uMsg == WM_MOUSEMOVE
invoke partition_widget_souris_scrolling, wParam, lParam
ret
.ELSE
invoke DefWindowProc, hWnd, uMsg, wParam, lParam
ret
.ENDIF
xor eax, eax
ret
partition_widget_proc endp
; *************************************************************************************
partition_widget_dessine_partition proc
LOCAL hdc:dword
LOCAL ps:PAINTSTRUCT
LOCAL s_info_hx:SCROLLINFO
LOCAL s_info_vy:SCROLLINFO
LOCAL hbrush:dword
invoke BeginPaint, ptwi.hwnd, addr ps
mov hdc, eax
; récupèration de la position des scrollbars
mov s_info_hx.fMask, SIF_POS
mov s_info_hx.cbSize, SIZEOF SCROLLINFO
invoke GetScrollInfo, ptwi.h_scrollbar_h, SB_CTL, addr s_info_hx
mov s_info_vy.fMask, SIF_POS
mov s_info_vy.cbSize, SIZEOF SCROLLINFO
invoke GetScrollInfo, ptwi.h_scrollbar_v, SB_CTL, addr s_info_vy
invoke SetMapMode, hdc, MM_ANISOTROPIC
invoke SetViewportExtEx, hdc, ptwi.rect_dessin.left, ptwi.rect_dessin.top, NULL
; pas de modification de la partition, donc simple affichage/recadrage
.if ptwi.flag_dessine_bitmap_zoom == 1
; fond du bitmap de reférence blanc
invoke CreateSolidBrush, 0FFFFFFh
mov hbrush, eax
invoke FillRect, ptwi.hdc_zoom_x1, addr ptwi.rect_bitmap, eax; addr ptwi.rect_dessin, eax
invoke DeleteObject, hbrush
; ********************************************************
; déssine les portées
invoke partition_widget_dessine_portees, hdc
; déssine les notes
invoke partition_widget_dessine_notes
mov ptwi.flag_dessine_bitmap_zoom, 0
.endif
; dessin final de l'ensemble visible
invoke BitBlt, hdc, 0, 0, ptwi.rect_dessin.right, ptwi.rect_dessin.bottom, ptwi.hdc_zoom_x1, s_info_hx.nPos, s_info_vy.nPos, SRCCOPY
invoke EndPaint, ptwi.hwnd, addr ps
ret
partition_widget_dessine_partition endp
; ****************************************************************************************************
partition_widget_init proc
LOCAL rect1:RECT
LOCAL hdc:dword
LOCAL hdc_zoom_x1:dword
; allouer de la mémoire pour les notes pour la simple ou double portée
; PADDING de 5 pour aligner les octaves et faciliter les futurs calculs :)
invoke GlobalAlloc, GPTR, ((NOTES_TEMPS_MAX + DECALAGE_OCTAVE_0) * TEMPS_MAX * TYPE note) * 2
.if eax == 0
invoke MessageBox, ptwi.hwnd, addr ErrMsgMemoire, addr ErrMsgGrave, MB_ICONSTOP or MB_OK
invoke ExitProcess, 1
.endif
mov notes_infos_portee_haute, eax
; notes_infos_portee_basse pointe sur l'autre moitié de la mémoire
add eax, ((NOTES_TEMPS_MAX + DECALAGE_OCTAVE_0) * TEMPS_MAX * TYPE note)
mov notes_infos_portee_basse, eax
; création des deux scrollbars avec des tailles aléatoires, modifié dans la gestion du message WM_SIZE
invoke GetModuleHandle, NULL
invoke CreateWindowEx, NULL, addr scrollbar_widget_class_name, NULL, WS_CHILD or SBS_VERT, 0, 0, 120, 20, ptwi.hwnd, NULL, eax, NULL
mov ptwi.h_scrollbar_v, eax
invoke GetModuleHandle, NULL
invoke CreateWindowEx, NULL, addr scrollbar_widget_class_name, NULL, WS_CHILD or SBS_HORZ, 250, 257, 120, 20, ptwi.hwnd, NULL, eax, NULL
mov ptwi.h_scrollbar_h, eax
; chargé les bitmaps prédéfinies
invoke GetModuleHandle, NULL
invoke LoadImage, eax, addr clef_fa_rsrc, IMAGE_BITMAP, CLEF_FA_BMP_X_MAX, CLEF_FA_BMP_Y_MAX, LR_CREATEDIBSECTION
mov ptwi.h_bitmap_clef_fa, eax
.if eax == 0
invoke MessageBox, ptwi.hwnd, addr ErrMsgBitmap, addr ErrMsgGrave, MB_ICONSTOP or MB_OK
invoke ExitProcess, 1
.endif
invoke GetModuleHandle, NULL
invoke LoadImage, eax, addr clef_sol_rsrc, IMAGE_BITMAP, CLEF_SOL_BMP_X_MAX, CLEF_SOL_BMP_Y_MAX, LR_CREATEDIBSECTION
mov ptwi.h_bitmap_clef_sol, eax
.if eax == 0
invoke MessageBox, ptwi.hwnd, addr ErrMsgBitmap, addr ErrMsgGrave, MB_ICONSTOP or MB_OK
invoke ExitProcess, 1
.endif
invoke GetModuleHandle, NULL
invoke LoadImage, eax, addr accolade_rsrc, IMAGE_BITMAP, ACCOLADE_BMP_X_MAX, ACCOLADE_BMP_Y_MAX, LR_CREATEDIBSECTION
mov ptwi.h_bitmap_accolade, eax
.if eax == 0
invoke MessageBox, ptwi.hwnd, addr ErrMsgBitmap, addr ErrMsgGrave, MB_ICONSTOP or MB_OK
invoke ExitProcess, 1
.endif
invoke GetModuleHandle, NULL
invoke LoadImage, eax, addr diese_rsrc, IMAGE_BITMAP, DIESE_BMP_X_MAX, DIESE_BMP_Y_MAX, LR_CREATEDIBSECTION
mov ptwi.h_bitmap_diese, eax
.if eax == 0
invoke MessageBox, ptwi.hwnd, addr ErrMsgBitmap, addr ErrMsgGrave, MB_ICONSTOP or MB_OK
invoke ExitProcess, 1
.endif
invoke GetModuleHandle, NULL
invoke LoadImage, eax, addr bemol_rsrc, IMAGE_BITMAP, BEMOL_BMP_X_MAX, BEMOL_BMP_Y_MAX, LR_CREATEDIBSECTION
mov ptwi.h_bitmap_bemol, eax
.if eax == 0
invoke MessageBox, ptwi.hwnd, addr ErrMsgBitmap, addr ErrMsgGrave, MB_ICONSTOP or MB_OK
invoke ExitProcess, 1
.endif
; **********
invoke SetStretchBltMode, ptwi.hdc_zoom_x1, STRETCH_DELETESCANS
; zoom par défaut
mov ptwi.zoom_min, 20
mov ptwi.zoom_max, 200
mov ptwi.zoom_partition, 60 ; 100 % -> taille réel
mov ptwi.zoom_partition_precedent, 60
; les pointeurs mémoire des bitmaps et hdc pas encore alloués
mov ptwi.hbitmap_zoom_x1, 0
mov ptwi.hdc_zoom_x1, 0
; par défaut l'autoscrolling est activé
invoke partition_widget_fixe_auto_scrolling, 1
; définir la portée de la partition et sa mise en page par défaut
; 25 notes par portée, 2 portées par défaut
invoke partition_widget_def, MODE_PORTEE_DOUBLE, CLEF_SOL, CLEF_FA, 25, 2
ret
partition_widget_init endp
; *****************************************
partition_widget_def proc m_portee:dword, clef1:dword, clef2:dword, nb_notes_portee:dword, nb_portees:dword
; mode la portée simple ou double
mov eax, m_portee
mov ptwi.mode_portee, eax
; type clef de la portée 1 et 2
mov eax, clef1
mov ptwi.clef_simple, eax
mov eax, clef2
mov ptwi.clef_double, eax
; nombre de note par portée
mov eax, nb_notes_portee
mov ptwi.notes_par_portee, eax
; nombre total de portée
mov eax, nb_portees
mov ptwi.nb_portee_max, eax
; TMP PAS D'ARMATURE
mov ptwi.armature_type, ARMATURE_NATURELLE
invoke partition_widget_bitmap_zoom_x1_alloc
; rendre invalide toutes les notes
invoke partition_widget_notes_reset
invoke partition_widget_resize
ret
partition_widget_def endp
; *************************************
partition_widget_bitmap_zoom_x1_alloc proc
LOCAL hdc:dword
invoke GetDC, ptwi.hwnd
mov hdc, eax
@re_calcul_zoom:
; taille objet à 100%
mov ptwi.marge_gauche, MARGE_GAUCHE
mov ptwi.marge_droite, MARGE_DROITE
mov ptwi.ecart_portee, ECART_PORTEE
mov ptwi.portee_simple, PORTEE_SIMPLE
mov ptwi.portee_double, PORTEE_DOUBLE
mov ptwi.ecart_portee_double, ECART_PORTEE_DOUBLE
mov ptwi.espace_mesure_note_noire, ESPACE_MESURE_NOTE_NOIRE
mov ptwi.ecart_accolade_portee, ECART_ACCOLADE_PORTEE
mov ptwi.ecart_accolade_clef_sol_x, ECART_ACCOLADE_CLEF_SOL_X
mov ptwi.ecart_accolade_clef_sol_y, ECART_ACCOLADE_CLEF_SOL_Y
mov ptwi.ecart_accolade_clef_fa_x, ECART_ACCOLADE_CLEF_FA_X
mov ptwi.ecart_accolade_clef_fa_y, ECART_ACCOLADE_CLEF_FA_Y
mov ptwi.ecart_clef_sol, ECART_CLEF_SOL
mov ptwi.ecart_clef_fa, ECART_CLEF_FA
mov ptwi.ecart_interligne, ECART_INTERLIGNE
mov ptwi.ecart_note_y, ECART_NOTE_Y
mov ptwi.ligne_sup_x, LIGNE_SUP_X
mov ptwi.hampe_taille, HAMPE_TAILLE
mov ptwi.hampe_x, HAMPE_X
mov ptwi.hampe_y, HAMPE_Y
mov ptwi.note_x, NOTE_X
mov ptwi.note_y, NOTE_Y
mov ptwi.note_correction_x, NOTE_CORRECTION_X
; taille des bitmaps à 100%
mov ptwi.bitmap_clef_sol_x_max, CLEF_SOL_BMP_X_MAX
mov ptwi.bitmap_clef_sol_y_max, CLEF_SOL_BMP_Y_MAX
mov ptwi.bitmap_clef_fa_x_max, CLEF_FA_BMP_X_MAX
mov ptwi.bitmap_clef_fa_y_max, CLEF_FA_BMP_Y_MAX
mov ptwi.bitmap_accolade_x_max, ACCOLADE_BMP_X_MAX
mov ptwi.bitmap_accolade_y_max, ACCOLADE_BMP_Y_MAX
mov ptwi.bitmap_diese_x_max, DIESE_BMP_X_MAX
mov ptwi.bitmap_diese_y_max, DIESE_BMP_Y_MAX
mov ptwi.bitmap_bemol_x_max, BEMOL_BMP_X_MAX
mov ptwi.bitmap_bemol_y_max, BEMOL_BMP_Y_MAX
; ************************************************
invoke partition_widget_calcul_zoom
; calculer l'axe des x maximum
; marge gauche + marge droite + notes_par_portee
mov eax, ptwi.notes_par_portee
; ajouter un peu de place en fin de la portée
add eax, 2
mov ecx, ptwi.espace_mesure_note_noire
mul ecx
; longueur d'une portee max
mov ptwi.portee_x_max, eax
add eax, ptwi.marge_gauche
add eax, ptwi.marge_droite
; fixer x max
mov ptwi.bitmap_x_max, eax
; calculer l'axe y maximum
mov eax, ptwi.ecart_portee
.if ptwi.mode_portee == MODE_PORTEE_SIMPLE
add eax, ptwi.portee_simple
.else
; MODE_PORTEE_DOUBLE
add eax, ptwi.portee_double
.endif
mov ecx, ptwi.nb_portee_max
mul ecx
add eax, ptwi.ecart_portee ; pour le dessous de la dernière portée
; fixer y max
mov ptwi.bitmap_y_max, eax
mov eax, ptwi.bitmap_x_max
mov edx, ptwi.bitmap_y_max
mov ptwi.rect_bitmap.left, 0
mov ptwi.rect_bitmap.right, eax
mov ptwi.rect_bitmap.top, 0
mov ptwi.rect_bitmap.bottom, edx
; libérer la mémoire
.if ptwi.hbitmap_zoom_x1 != 0
invoke DeleteObject, ptwi.hbitmap_zoom_x1
.endif
.if ptwi.hdc_zoom_x1 != 0
invoke DeleteDC, ptwi.hdc_zoom_x1
.endif
invoke CreateCompatibleBitmap, hdc, ptwi.bitmap_x_max, ptwi.bitmap_y_max
mov ptwi.hbitmap_zoom_x1, eax
.if eax == 0
mov eax, ptwi.zoom_partition_precedent
.if ptwi.zoom_partition != eax
; dernière chance :) , refixer l'ancien zoom et refaire les calculs
mov ptwi.zoom_partition, eax
jmp @re_calcul_zoom
.endif
; ici l'ancien zoom correspond au nouveau
; donc plus rien à faire, quitter le programme :(
invoke MessageBox, ptwi.hwnd, addr ErrMsgPartition, addr ErrMsgGrave, MB_ICONSTOP or MB_OK
invoke ExitProcess, 1
.endif ; erreur CreateCompatibleBitmap
invoke CreateCompatibleDC, hdc
mov ptwi.hdc_zoom_x1, eax
invoke SelectObject, ptwi.hdc_zoom_x1, ptwi.hbitmap_zoom_x1
invoke ReleaseDC, ptwi.hwnd, hdc
; nombre maximum de notes de cette partition
mov eax, ptwi.nb_portee_max
mov edx, ptwi.notes_par_portee
mul edx
mov ptwi.nb_temps_max, eax
; nouveau bitmap d'affichage, redéssiner le bitmap
mov ptwi.flag_dessine_bitmap_zoom, 1
ret
partition_widget_bitmap_zoom_x1_alloc endp
; ****************************************
partition_widget_calcul_zoom proc
; recalculer la taille de tous les objets graphiques
mov eax, ptwi.marge_gauche
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.marge_gauche, eax
mov eax, ptwi.marge_droite
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.marge_droite, eax
mov eax, ptwi.ecart_portee
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.ecart_portee, eax
mov eax, ptwi.portee_simple
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.portee_simple, eax
mov eax, ptwi.portee_double
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.portee_double, eax
mov eax, ptwi.ecart_portee_double
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.ecart_portee_double, eax
mov eax, ptwi.espace_mesure_note_noire
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.espace_mesure_note_noire, eax
mov eax, ptwi.ecart_accolade_portee
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.ecart_accolade_portee, eax
mov eax, ptwi.ecart_accolade_clef_sol_x
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.ecart_accolade_clef_sol_x, eax
mov eax, ptwi.ecart_accolade_clef_sol_y
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.ecart_accolade_clef_sol_y, eax
mov eax, ptwi.ecart_accolade_clef_fa_x
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.ecart_accolade_clef_fa_x, eax
mov eax, ptwi.ecart_accolade_clef_fa_y
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.ecart_accolade_clef_fa_y, eax
mov eax, ptwi.ecart_clef_sol
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.ecart_clef_sol, eax
mov eax, ptwi.ecart_clef_fa
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.ecart_clef_fa, eax
mov eax, ptwi.ecart_interligne
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.ecart_interligne, eax
mov eax, ptwi.ecart_note_y
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.ecart_note_y, eax
mov eax, ptwi.ligne_sup_x
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.ligne_sup_x, eax
mov eax, ptwi.hampe_taille
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.hampe_taille, eax
mov eax, ptwi.hampe_x
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.hampe_x, eax
mov eax, ptwi.hampe_y
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.hampe_y, eax
mov eax, ptwi.note_x
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.note_x, eax
mov eax, ptwi.note_y
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.note_y, eax
; les bitmaps
mov eax, ptwi.bitmap_clef_sol_x_max
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.bitmap_clef_sol_x_max, eax
mov eax, ptwi.bitmap_clef_sol_y_max
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.bitmap_clef_sol_y_max, eax
mov eax, ptwi.bitmap_clef_fa_x_max
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.bitmap_clef_fa_x_max, eax
mov eax, ptwi.bitmap_clef_fa_y_max
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.bitmap_clef_fa_y_max, eax
mov eax, ptwi.bitmap_accolade_x_max
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.bitmap_accolade_x_max, eax
mov eax, ptwi.bitmap_accolade_y_max
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.bitmap_accolade_y_max, eax
mov eax, ptwi.bitmap_diese_x_max
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.bitmap_diese_x_max, eax
mov eax, ptwi.bitmap_diese_y_max
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.bitmap_diese_y_max, eax
mov eax, ptwi.bitmap_bemol_x_max
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.bitmap_bemol_x_max, eax
mov eax, ptwi.bitmap_bemol_y_max
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.bitmap_bemol_y_max, eax
mov eax, ptwi.note_correction_x
mov edx, ptwi.zoom_partition
mul edx
xor edx, edx
mov ecx, 100
div ecx
mov ptwi.note_correction_x, eax
ret
partition_widget_calcul_zoom endp
; *******************************************
partition_widget_resize proc