[med-svn] [Git][med-team/praat][master] 5 commits: New upstream version 6.1.34
Rafael Laboissiere
gitlab at salsa.debian.org
Thu Nov 26 12:42:24 GMT 2020
Rafael Laboissiere pushed to branch master at Debian Med / praat
Commits:
e799fa2d by Rafael Laboissière at 2020-11-26T06:14:22-03:00
New upstream version 6.1.34
- - - - -
496b050a by Rafael Laboissière at 2020-11-26T06:16:48-03:00
Merge tag 'upstream/6.1.34'
Upstream version 6.1.34
- - - - -
a168553f by Rafael Laboissière at 2020-11-26T06:21:19-03:00
d/What_s_new_.html: Update upstream changelog
Gbp-Dch: Ignore
- - - - -
9d688125 by Rafael Laboissière at 2020-11-26T06:23:36-03:00
Use SVG icon from upstream tarball
+ d/praat.svg: Remove file
+ d/install.in: Install file main/praat.svg
Gbp-Dch: Full
- - - - -
e361c9ef by Rafael Laboissière at 2020-11-26T09:41:34-03:00
Changelog entry for version 6.1.34-1
Gbp-Dch: Ignore
- - - - -
19 changed files:
- README.md
- debian/What_s_new_.html
- debian/changelog
- debian/install.in
- fon/Matrix.cpp
- fon/SoundRecorder.cpp
- fon/manual_Picture.cpp
- fon/manual_programming.cpp
- fon/manual_sound.cpp
- fon/manual_tutorials.cpp
- debian/praat.svg → main/praat.svg
- sys/Editor.cpp
- sys/Graphics.h
- sys/GraphicsScreen.cpp
- sys/Graphics_text.cpp
- sys/GuiDrawingArea.cpp
- sys/GuiMenu.cpp
- sys/praat_picture.cpp
- sys/praat_version.h
Changes:
=====================================
README.md
=====================================
@@ -202,7 +202,7 @@ or `praat-build` into a Windows or Linux terminal (or `praat-run` to build and r
### 4.1. MacOS development set-up
Your source code folders, such as `fon` and `sys`, will reside in a folder like `/Users/yourname/Praats/src`,
-where you also put `praat64.xcodeproj`, as described above in 3.2.
+where you also put `praat.xcodeproj`, as described above in 3.2.
On Paul’s 2018 MacBook Pro with Xcode 12.2, building Praat with Command-B or Command-R,
after cleaning the build folder with Shift-Command-K,
takes 120 seconds for the x86_64 part and 110 seconds for the ARM64 part (optimization level O3).
@@ -469,16 +469,16 @@ you include the executable in a `.dmg` disk image, with the following commands:
PRAAT_WWW=~/Praats/www
PRAAT_VERSION=9999
cd ~/builds/mac_products/Configuration64
- hdiutil create -fs HFS+ -ov -srcfolder Praat.app -volname Praat64_${PRAAT_VERSION} praat64_${PRAAT_VERSION}.dmg
- hdiutil convert -ov -format UDZO -o ${PRAAT_WWW}/praat${PRAAT_VERSION}_mac64.dmg praat64_${PRAAT_VERSION}.dmg
- rm praat64_${PRAAT_VERSION}.dmg
+ hdiutil create -fs HFS+ -ov -srcfolder Praat.app -volname Praat_${PRAAT_VERSION} praat_${PRAAT_VERSION}.dmg
+ hdiutil convert -ov -format UDZO -o ${PRAAT_WWW}/praat${PRAAT_VERSION}_mac.dmg praat_${PRAAT_VERSION}.dmg
+ rm praat_${PRAAT_VERSION}.dmg
You also need to distribute the `.xcodeproj` file, which is actually a folder, so that you have to zip it:
# on Mac command line
PRAAT_SOURCES="~/Praats/src
cd $PRAAT_SOURCES
- zip -r $PRAAT_WWW/praat$(PRAAT_VERSION)_xcodeproj64.zip praat64.xcodeproj
+ zip -r $PRAAT_WWW/praat$(PRAAT_VERSION)_xcodeproj.zip praat.xcodeproj
The Windows executables have to be sent from your Cygwin terminal to your Mac.
It is easiest to do this without a version number (so that you have to supply the number only once),
=====================================
debian/What_s_new_.html
=====================================
@@ -7,6 +7,14 @@ What's new?
<p>
Latest changes in Praat.</p>
<p>
+<b>6.1.34</b> (25 November 2020)</p>
+<ul>
+<li>
+ Mac: got bold and italic to work on Praat versions compiled with the BigSur API.
+<li>
+ SoundRecorder always a white background, instead of a different background on each platform.
+</ul>
+<p>
<b>6.1.33</b> (19 November 2020)</p>
<ul>
<li>
@@ -318,7 +326,7 @@ What used to be new?</h3>
</ul>
<hr>
<address>
- <p>© ppgb, November 19, 2020</p>
+ <p>© ppgb, November 25, 2020</p>
</address>
</body>
</html>
=====================================
debian/changelog
=====================================
@@ -1,3 +1,13 @@
+praat (6.1.34-1) unstable; urgency=medium
+
+ * New upstream version 6.1.34
+ * d/control: Bump Standards-Version to 4.5.1 (no changes needed)
+ * Use SVG icon from upstream tarball
+ + d/praat.svg: Remove file
+ + d/install.in: Install file main/praat.svg
+
+ -- Rafael Laboissière <rafael at debian.org> Thu, 26 Nov 2020 06:24:52 -0300
+
praat (6.1.33-1) unstable; urgency=medium
* New upstream version 6.1.33
=====================================
debian/install.in
=====================================
@@ -3,5 +3,5 @@ praat_nogui @BINDIR@
sendpraat @BINDIR@
debian/praat-open-files @BINDIR@
debian/praat.xpm @PIXDIR@
-debian/praat.svg @SVGDIR@
+main/praat.svg @SVGDIR@
main/praat.desktop @APPDIR@
=====================================
fon/Matrix.cpp
=====================================
@@ -437,6 +437,8 @@ void Matrix_paintSurface (Matrix me, Graphics g, double xmin, double xmax, doubl
void Matrix_playMovie (Matrix me, Graphics g) {
Melder_require (my ny >= 2,
me, U": cannot play a movie for a Matrix with less than 2 rows.");
+ if (my xmin == my xmax || my ymin == my ymax)
+ return;
autoVEC column = newVECraw (my ny);
double minimum = 0.0, maximum = 1.0;
Matrix_getWindowExtrema (me, 1, my nx, 1, my ny, & minimum, & maximum);
=====================================
fon/SoundRecorder.cpp
=====================================
@@ -294,6 +294,7 @@ static void showMaximum (SoundRecorder me, int channel, double maximum) {
static void showMeter (SoundRecorder me, const short *buffertje, integer nsamp) {
Melder_assert (my graphics);
+ Graphics_clearWs (my graphics.get());
if (nsamp < 1) {
Graphics_setWindow (my graphics.get(), 0.0, 1.0, 0.0, 1.0);
#if defined (macintosh)
=====================================
fon/manual_Picture.cpp
=====================================
@@ -879,13 +879,8 @@ INTRO (U"One of the commands in the #Select menu of the @@Picture window at .")
ENTRY (U"Purpose")
NORMAL (U"To determine where your next drawing will occur.")
ENTRY (U"The viewport")
-#ifdef macintosh
-NORMAL (U"The \"viewport\" is the part of the Picture window where your next drawing will occur. "
- "You can set the colour of its margins with ##System Preferences \\-> Appearance \\-> Highlight Colour#. ")
-#else
NORMAL (U"The \"viewport\" is the part of the Picture window where your next drawing will occur. "
"Its margins are pink.")
-#endif
NORMAL (U"The %inner viewport does not include the margins, the %outer viewport does (see @@Select outer viewport...@).")
NORMAL (U"Normally, you select the viewport by dragging your mouse across the Picture window. "
"However, you would use this explicit command:")
@@ -898,13 +893,8 @@ INTRO (U"One of the commands in the #Select menu of the @@Picture window at .")
ENTRY (U"Purpose")
NORMAL (U"To determine where your next drawing will occur.")
ENTRY (U"The viewport")
-#ifdef macintosh
-NORMAL (U"The \"viewport\" is the part of the Picture window where your next drawing will occur. "
- "You can set the colour of its margins with ##System Preferences \\-> Appearance \\-> Highlight Colour#. ")
-#else
NORMAL (U"The \"viewport\" is the part of the Picture window where your next drawing will occur. "
"Its margins are pink.")
-#endif
NORMAL (U"The %outer viewport includes the margins, the %inner viewport does not (see @@Select inner viewport...@).")
NORMAL (U"Normally, you select the viewport by dragging your mouse across the Picture window. "
"However, you would use this explicit command:")
=====================================
fon/manual_programming.cpp
=====================================
@@ -1,6 +1,6 @@
/* manual_programming.cpp
*
- * Copyright (C) 1992-2010,2011,2013,2015-2018 Paul Boersma
+ * Copyright (C) 1992-2010,2011,2013,2015-2020 Paul Boersma
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
=====================================
fon/manual_sound.cpp
=====================================
@@ -1,6 +1,6 @@
/* manual_sound.cpp
*
- * Copyright (C) 1992-2008,2010-2012,2014-2017 Paul Boersma
+ * Copyright (C) 1992-2008,2010-2012,2014-2020 Paul Boersma
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -205,9 +205,8 @@ INTRO (U"A command in the @@Open menu@ of the #Objects window. "
"If the file name is hello.wav, Praat will name the channels hello_ch1, hello_ch2, and so on.")
MAN_END
-MAN_BEGIN (U"Record mono Sound...", U"ppgb", 20021212)
-INTRO (U"A command in the @@New menu@ to record a @Sound. Creates a @SoundRecorder window, "
- "except on very old Macintoshes with 8-bit audio, where it presents a native Macintosh sound-recorder window.")
+MAN_BEGIN (U"Record mono Sound...", U"ppgb", 20201120)
+INTRO (U"A command in the @@New menu@ to record a @Sound. Creates a @SoundRecorder window.")
MAN_END
MAN_BEGIN (U"Record stereo Sound...", U"ppgb", 20021212)
@@ -1028,7 +1027,7 @@ NORMAL (U"To synchronize a SoundEditor window with other windows that show a tim
"You cannot Cut from or Paste into a synchronized SoundEditor window.")
MAN_END
-MAN_BEGIN (U"SoundRecorder", U"ppgb", 20110129)
+MAN_BEGIN (U"SoundRecorder", U"ppgb", 20201120)
INTRO (U"With the Praat SoundRecorder window you can record a mono or stereo sound "
"for subsequent viewing and analysis in Praat. "
"The SoundRecorder appears on your screen if you choose @@Record mono Sound...@ or @@Record stereo Sound...@ "
@@ -1050,29 +1049,24 @@ NORMAL (U"The size of the recording buffer determines how many seconds of sound
"or 110 seconds in stereo (220 seconds in mono) at a sampling frequency of 44100 Hz. "
"You can change the size of the recording buffer "
"with ##Sound input prefs...# from the Preferences menu.")
-NORMAL (U"If you recorded a very long sound, it is probable that you cannot copy it to the list of objects. "
- "In such a case, you can still write the sound to disk with one of the #Save commands in the #File menu. "
- "You can then open such a long sound file in Praat with @@Open long sound file...@ from the Open menu.")
-#ifdef macintosh
-ENTRY (U"Recording sounds on MacOS X")
-NORMAL (U"You can record from the combined microphone / line input. On some computers, these are separate.")
-NORMAL (U"Note that in MacOS X you cannot record from the internal CD. This is because the system provides you with something better. "
- "If you open the CD in the Finder, you will see the audio tracks as AIFC files! "
- "To open these audio tracks in Praat, use @@Read from file...@ or @@Open long sound file... at .")
-#endif
-#ifdef _WIN32
-ENTRY (U"Recording sounds in Windows")
-NORMAL (U"In Windows, you can choose your input device with the help of the recording mixer that is supplied by Windows or comes with "
- "your sound card. There will usually be a loudspeaker icon in the Start bar; double-click it, and you will see the %playing mixer "
- "(if there is no loudspeaker icon, go to ##Control Panels#, then ##Sounds and Audio Devices#, then #Volume, then #Advanced; "
- "do not blame us for how Windows XP works). In the playing mixer, choose #Properties from the #Option menu, then click #Recording, "
- "then #OK. You are now in the %recording mixer.")
-NORMAL (U"You can watch the input level only while recording.")
-#endif
+ENTRY (U"Recording sounds on the Mac or in Linux")
+NORMAL (U"On the Mac or in Linux, you can record from the list on the left in the SoundRecorder window. "
+ "The list can contain several devices, such as the internal microphone, a line input, or external USB devices. "
+ "Audio tracks on a CD can be opened directly with @@Read from file...@ or @@Open long sound file... at .")
+ENTRY (U"Recording sounds in Windows 10")
+NORMAL (U"In Windows 10, you can choose your input device by right-clicking on the loudspeaker icon in the Start bar; "
+ "then ##Open Sound settings#, then ##Choose your input device#. "
+ "To set some input #Properties, right-click the loudspeaker icon, then #Sounds, then #Recording.")
+ENTRY (U"Watching the input level")
+NORMAL (U"While recording, you can watch the input level as a green rectangle whose size changes. "
+ "Whenever the input is loud, the top of the rectangle becomes yellow; if it turns red, the sound may have been clipped. "
+ "In the Meter menu you cna choose other visualizations, "
+ "such as a moving ball that measures spectral centre of gravity (horizontally) versus intensity (vertically).")
ENTRY (U"The File menu")
-NORMAL (U"If your computer has little memory, a very long recorded sound can be too big to be copied to the list of objects. "
+NORMAL (U"If your computer has little memory, a very long recorded sound might be too big to be copied to the list of objects. "
"Fortunately, the File menu contains commands to save the recording "
- "to a sound file on disk, so that you will never have to lose your recording.")
+ "to a sound file on disk, so that you will never have to lose your recording. "
+ "You can later open such a long sound file in Praat with @@Open long sound file...@ from the Open menu.")
ENTRY (U"Sound pressure calibration")
NORMAL (U"Your computer's sound-recording software returns integer values between -32768 and 32767. "
"Praat divides them by 32768 before putting them into a Sound object, "
=====================================
fon/manual_tutorials.cpp
=====================================
@@ -22,8 +22,11 @@
void manual_tutorials_init (ManPages me);
void manual_tutorials_init (ManPages me) {
-MAN_BEGIN (U"What's new?", U"ppgb", 20201119)
+MAN_BEGIN (U"What's new?", U"ppgb", 20201125)
INTRO (U"Latest changes in Praat.")
+NORMAL (U"##6.1.34# (25 November 2020)")
+LIST_ITEM (U"• Mac: got bold and italic to work on Praat versions compiled with the BigSur API.")
+LIST_ITEM (U"• SoundRecorder always a white background, instead of a different background on each platform.")
NORMAL (U"##6.1.33# (19 November 2020)")
LIST_ITEM (U"• Mac: got audio to work on Praat versions compiled with the BigSur API (6.1.32 did not have audio on BigSur).")
NORMAL (U"##6.1.32# (16 November 2020)")
@@ -2504,36 +2507,14 @@ LIST_ITEM (U"@@Intro 1.2. Reading a sound from disk")
LIST_ITEM (U"@@Intro 1.3. Creating a sound from a formula")
MAN_END
-MAN_BEGIN (U"Intro 1.1. Recording a sound", U"ppgb", 20110128)
-#ifdef macintosh
- INTRO (U"To record a speech sound into Praat, you need a computer with a microphone.")
- NORMAL (U"To record from the microphone, perform the following steps:")
-#else
- INTRO (U"To record a speech sound into Praat, you need a computer with a microphone. "
- "If you do not have a microphone, try to record from an audio CD instead.")
- NORMAL (U"To record from the microphone (or the CD), perform the following steps:")
-#endif
+MAN_BEGIN (U"Intro 1.1. Recording a sound", U"ppgb", 20201120)
+INTRO (U"To record a speech sound into Praat, you need a computer with a microphone.")
+NORMAL (U"To record from the microphone, perform the following steps:")
LIST_ITEM (U"1. Choose @@Record mono Sound...@ from the @@New menu@ in the @@Object window at . "
"A @SoundRecorder window will appear on your screen.")
-#if defined (_WIN32)
- LIST_ITEM (U"2. Choose the appropriate input device, namely the microphone, by the following steps. "
- "If there is a small loudspeaker symbol in the Windows Start bar, double click it and you will see the %playing mixer. "
- "If there is no loudspeaker symbol, go to ##Control Panels#, then ##Sounds and Audio Devices#, then #Volume, then #Advanced, "
- "and you will finally see the playing mixer. "
- "Once you see the Windows playing mixer, choose #Properties from the #Option menu, "
- "then click #Recording, then #OK. You now see the %recording mixer, where you can select the microphone "
- "(if you do not like this complicated operation, try Praat on Macintosh or Linux instead of Windows).")
-#elif defined (macintosh)
- LIST_ITEM (U"2. In the SoundRecorder window, choose the appropriate input device, e.g. choose ##Internal microphone#.")
-#else
- LIST_ITEM (U"2. In the SoundRecorder window, choose the appropriate input device, i.e. choose #Microphone (or #CD, or #Line).")
-#endif
-#ifdef macintosh
- LIST_ITEM (U"3. Use the #Record and #Stop buttons to record a few seconds of your speech.")
-#else
- LIST_ITEM (U"3. Use the #Record and #Stop buttons to record a few seconds of your speech "
- "(or a few seconds of music from your playing CD).")
-#endif
+LIST_ITEM (U"2. On the left in the SoundRecorder window, choose the appropriate input device, e.g. choose ##Internal microphone#. "
+ "(On Windows, instead right-click the loudspeaker symbol in the Start bar; see @SoundRecorder for more details.)")
+LIST_ITEM (U"3. Use the #Record and #Stop buttons to record a few seconds of your speech.")
LIST_ITEM (U"4. Use the #Play button to hear what you have recorded.")
LIST_ITEM (U"5. Repeat steps 3 and 4 until you are satisfied with your recording.")
LIST_ITEM (U"6. Click the ##Save to list# button. Your recording will now appear in the Object window, "
=====================================
debian/praat.svg → main/praat.svg
=====================================
=====================================
sys/Editor.cpp
=====================================
@@ -321,7 +321,8 @@ static void menu_cb_settingsReport (Editor me, EDITOR_ARGS_DIRECT) {
}
static void menu_cb_info (Editor me, EDITOR_ARGS_DIRECT) {
- if (my data) Thing_info (my data);
+ if (my data)
+ Thing_info (my data);
}
void structEditor :: v_createMenuItems_query (EditorMenu menu) {
@@ -449,7 +450,7 @@ void Editor_init (Editor me, int x, int y, int width, int height, conststring32
top += Machine_getTitleBarHeight ();
bottom += Machine_getTitleBarHeight ();
#endif
- my windowForm = GuiWindow_create (left, top, width, height, 450, 250, title, gui_window_cb_goAway, me, my v_canFullScreen () ? GuiWindow_FULLSCREEN : 0);
+ my windowForm = GuiWindow_create (left, top, width, height, 450, 350, title, gui_window_cb_goAway, me, my v_canFullScreen () ? GuiWindow_FULLSCREEN : 0);
Thing_setName (me, title);
my data = data;
my v_copyPreferencesToInstance ();
=====================================
sys/Graphics.h
=====================================
@@ -334,10 +334,6 @@ void Graphics_marksRightEvery (Graphics me, double units, double distance, bool
void Graphics_marksBottomEvery (Graphics me, double units, double distance, bool haveNumbers, bool haveTicks, bool haveDottedLines);
void Graphics_marksTopEvery (Graphics me, double units, double distance, bool haveNumbers, bool haveTicks, bool haveDottedLines);
-void *Graphics_x_getCR (Graphics me);
-void Graphics_x_setCR (Graphics me, void *cr);
-void *Graphics_x_getGC (Graphics me);
-
bool Graphics_startRecording (Graphics me);
bool Graphics_stopRecording (Graphics me);
void Graphics_clearRecording (Graphics me);
@@ -357,10 +353,5 @@ void Graphics_nextSheetOfPaper (Graphics me);
void Graphics_prefs ();
-#ifdef macintosh
- void GraphicsQuartz_initDraw (Graphics me);
- void GraphicsQuartz_exitDraw (Graphics me);
-#endif
-
/* End of file Graphics.h */
#endif
=====================================
sys/GraphicsScreen.cpp
=====================================
@@ -671,21 +671,4 @@ autoGraphics Graphics_create_pdf (void *context, int resolution,
}
#endif
-#if quartz
- void GraphicsQuartz_initDraw (Graphics me_generic) {
- GraphicsScreen me = static_cast <GraphicsScreen> (me_generic);
- if (my d_macView) {
- my d_macGraphicsContext = Melder_systemVersion < 101400 ?
- (CGContextRef) [[NSGraphicsContext currentContext] graphicsPort] :
- [[NSGraphicsContext currentContext] CGContext];
- Melder_assert (!! my d_macGraphicsContext);
- }
- }
- void GraphicsQuartz_exitDraw (Graphics me_generic) {
- GraphicsScreen me = static_cast <GraphicsScreen> (me_generic);
- if (my d_macView)
- my d_macGraphicsContext = nullptr;
- }
-#endif
-
/* End of file GraphicsScreen.cpp */
=====================================
sys/Graphics_text.cpp
=====================================
@@ -551,6 +551,102 @@ static void charSize (Graphics anyGraphics, _Graphics_widechar *lc) {
}
}
+#if quartz
+static conststring32 quartz_getFontName (int font, int style) {
+ if (Melder_systemVersion < 110000)
+ style = 0; // style extension in the name was not needed on macOS X
+ switch (font) {
+ case (int) kGraphics_font::TIMES:
+ return
+ style == 0 ? U"Times New Roman"
+ : style == Graphics_BOLD ? U"Times New Roman Bold"
+ : style == Graphics_ITALIC ? U"Times New Roman Italic"
+ : U"Times New Roman Bold-Italic";
+ case (int) kGraphics_font::HELVETICA:
+ return
+ style == 0 ? U"Arial"
+ : style == Graphics_BOLD ? U"Arial Bold"
+ : style == Graphics_ITALIC ? U"Arial Italic"
+ : U"Arial Bold-Italic";
+ case (int) kGraphics_font::COURIER:
+ return
+ style == 0 ? U"Courier New"
+ : style == Graphics_BOLD ? U"Courier New Bold"
+ : style == Graphics_ITALIC ? U"Courier New Italic"
+ : U"Courier New Bold-Italic";
+ case (int) kGraphics_font::PALATINO:
+ if (Melder_debug == 900)
+ return U"DG Meta Serif Science";
+ else
+ return style == 0 ? U"Palatino"
+ : style == Graphics_BOLD ? U"Palatino Bold"
+ : style == Graphics_ITALIC ? U"Palatino Italic"
+ : U"Palatino Bold-Italic";
+ case kGraphics_font_SYMBOL:
+ return U"Symbol";
+ case kGraphics_font_IPATIMES:
+ return U"Doulos SIL";
+ case kGraphics_font_IPAPALATINO:
+ return
+ style == 0 ? U"Charis SIL"
+ : style == Graphics_BOLD ? U"Charis SIL Bold"
+ : style == Graphics_ITALIC ? U"Charis SIL Italic"
+ : U"Charis SIL Bold-Italic";
+ case kGraphics_font_DINGBATS:
+ return U"Zapf Dingbats";
+ default:
+ return nullptr;
+ }
+}
+static CTFontRef quartz_getFontRef (int font, int size, int style) {
+ CTFontSymbolicTraits ctStyle = ( style & Graphics_BOLD ? kCTFontBoldTrait : 0 ) | ( style & Graphics_ITALIC ? kCTFontItalicTrait : 0 );
+#if 1
+ CFStringRef key = kCTFontSymbolicTrait;
+ CFNumberRef value = CFNumberCreate (nullptr, kCFNumberIntType, & ctStyle);
+ CFIndex numberOfValues = 1;
+ CFDictionaryRef styleDict = CFDictionaryCreate (nullptr, (const void **) & key, (const void **) & value, numberOfValues,
+ & kCFTypeDictionaryKeyCallBacks, & kCFTypeDictionaryValueCallBacks);
+ CFRelease (value);
+ CFStringRef keys [2];
+ keys [0] = kCTFontTraitsAttribute;
+ keys [1] = kCTFontNameAttribute;
+ conststring32 fontName = quartz_getFontName (font, style);
+ CFStringRef cfFont = (CFStringRef) Melder_peek32toCfstring (fontName);
+ void *values [2] = { (void *) styleDict, (void *) cfFont };
+ CFDictionaryRef attributes = CFDictionaryCreate (nullptr, (const void **) & keys, (const void **) & values, 2,
+ & kCFTypeDictionaryKeyCallBacks, & kCFTypeDictionaryValueCallBacks);
+ CFRelease (styleDict);
+ CTFontDescriptorRef ctFontDescriptor = CTFontDescriptorCreateWithAttributes (attributes);
+ CFRelease (attributes);
+#else
+ NSMutableDictionary *styleDict = [[NSMutableDictionary alloc] initWithCapacity: 1];
+ [styleDict setObject: [NSNumber numberWithUnsignedInt: ctStyle] forKey: (id) kCTFontSymbolicTrait];
+ NSMutableDictionary *attributes = [[NSMutableDictionary alloc] initWithCapacity: 2];
+ [attributes setObject: styleDict forKey: (id) kCTFontTraitsAttribute];
+ switch (font) {
+ case (int) kGraphics_font::TIMES: { [attributes setObject: @"Times New Roman" forKey: (id) kCTFontNameAttribute]; } break;
+ case (int) kGraphics_font::HELVETICA: { [attributes setObject: @"Arial" forKey: (id) kCTFontNameAttribute]; } break;
+ case (int) kGraphics_font::COURIER: { [attributes setObject: @"Courier New" forKey: (id) kCTFontNameAttribute]; } break;
+ case (int) kGraphics_font::PALATINO: { if (Melder_debug == 900)
+ [attributes setObject: @"DG Meta Serif Science" forKey: (id) kCTFontNameAttribute];
+ else
+ [attributes setObject: @"Palatino" forKey: (id) kCTFontNameAttribute];
+ } break;
+ case kGraphics_font_SYMBOL: { [attributes setObject: @"Symbol" forKey: (id) kCTFontNameAttribute]; } break;
+ case kGraphics_font_IPATIMES: { [attributes setObject: @"Doulos SIL" forKey: (id) kCTFontNameAttribute]; } break;
+ case kGraphics_font_IPAPALATINO: { [attributes setObject: @"Charis SIL" forKey: (id) kCTFontNameAttribute]; } break;
+ case kGraphics_font_DINGBATS: { [attributes setObject: @"Zapf Dingbats" forKey: (id) kCTFontNameAttribute]; } break;
+ }
+ CTFontDescriptorRef ctFontDescriptor = CTFontDescriptorCreateWithAttributes ((CFMutableDictionaryRef) attributes);
+ [styleDict release];
+ [attributes release];
+#endif
+ CTFontRef ctFont = CTFontCreateWithFontDescriptor (ctFontDescriptor, size, nullptr);
+ CFRelease (ctFontDescriptor);
+ return ctFont;
+}
+#endif
+
static void charDraw (Graphics anyGraphics, int xDC, int yDC, _Graphics_widechar *lc,
const char32 codes [], int nchars, int width)
{
@@ -696,66 +792,9 @@ static void charDraw (Graphics anyGraphics, int xDC, int yDC, _Graphics_widechar
Determine the font-style combination.
*/
CTFontRef ctFont = theScreenFonts [font] [lc -> size] [style];
- if (! ctFont) {
- CTFontSymbolicTraits ctStyle = ( style & Graphics_BOLD ? kCTFontBoldTrait : 0 ) | ( lc -> style & Graphics_ITALIC ? kCTFontItalicTrait : 0 );
- #if 1
- CFStringRef key = kCTFontSymbolicTrait;
- CFNumberRef value = CFNumberCreate (nullptr, kCFNumberIntType, & ctStyle);
- CFIndex numberOfValues = 1;
- CFDictionaryRef styleDict = CFDictionaryCreate (nullptr, (const void **) & key, (const void **) & value, numberOfValues,
- & kCFTypeDictionaryKeyCallBacks, & kCFTypeDictionaryValueCallBacks);
- CFRelease (value);
- CFStringRef keys [2];
- keys [0] = kCTFontTraitsAttribute;
- keys [1] = kCTFontNameAttribute;
- CFStringRef cfFont;
- switch (font) {
- case (int) kGraphics_font::TIMES: { cfFont = (CFStringRef) Melder_peek32toCfstring (U"Times New Roman"); } break;
- case (int) kGraphics_font::HELVETICA: { cfFont = (CFStringRef) Melder_peek32toCfstring (U"Arial" ); } break;
- case (int) kGraphics_font::COURIER: { cfFont = (CFStringRef) Melder_peek32toCfstring (U"Courier New" ); } break;
- case (int) kGraphics_font::PALATINO: { if (Melder_debug == 900)
- cfFont = (CFStringRef) Melder_peek32toCfstring (U"DG Meta Serif Science");
- else
- cfFont = (CFStringRef) Melder_peek32toCfstring (U"Palatino");
- } break;
- case kGraphics_font_SYMBOL: { cfFont = (CFStringRef) Melder_peek32toCfstring (U"Symbol" ); } break;
- case kGraphics_font_IPATIMES: { cfFont = (CFStringRef) Melder_peek32toCfstring (U"Doulos SIL" ); } break;
- case kGraphics_font_IPAPALATINO: { cfFont = (CFStringRef) Melder_peek32toCfstring (U"Charis SIL" ); } break;
- case kGraphics_font_DINGBATS: { cfFont = (CFStringRef) Melder_peek32toCfstring (U"Zapf Dingbats" ); } break;
- }
- void *values [2] = { (void *) styleDict, (void *) cfFont };
- CFDictionaryRef attributes = CFDictionaryCreate (nullptr, (const void **) & keys, (const void **) & values, 2,
- & kCFTypeDictionaryKeyCallBacks, & kCFTypeDictionaryValueCallBacks);
- CFRelease (styleDict);
- CTFontDescriptorRef ctFontDescriptor = CTFontDescriptorCreateWithAttributes (attributes);
- CFRelease (attributes);
- #else /* Preparing for the time to come when Apple deprecates Core Foundation. */
- NSMutableDictionary *styleDict = [[NSMutableDictionary alloc] initWithCapacity: 1];
- [styleDict setObject: [NSNumber numberWithUnsignedInt: ctStyle] forKey: (id) kCTFontSymbolicTrait];
- NSMutableDictionary *attributes = [[NSMutableDictionary alloc] initWithCapacity: 2];
- [attributes setObject: styleDict forKey: (id) kCTFontTraitsAttribute];
- switch (font) {
- case (int) kGraphics_font::TIMES: { [attributes setObject: @"Times New Roman" forKey: (id) kCTFontNameAttribute]; } break;
- case (int) kGraphics_font::HELVETICA: { [attributes setObject: @"Arial" forKey: (id) kCTFontNameAttribute]; } break;
- case (int) kGraphics_font::COURIER: { [attributes setObject: @"Courier New" forKey: (id) kCTFontNameAttribute]; } break;
- case (int) kGraphics_font::PALATINO: { if (Melder_debug == 900)
- [attributes setObject: @"DG Meta Serif Science" forKey: (id) kCTFontNameAttribute];
- else
- [attributes setObject: @"Palatino" forKey: (id) kCTFontNameAttribute];
- } break;
- case kGraphics_font_SYMBOL: { [attributes setObject: @"Symbol" forKey: (id) kCTFontNameAttribute]; } break;
- case kGraphics_font_IPATIMES: { [attributes setObject: @"Doulos SIL" forKey: (id) kCTFontNameAttribute]; } break;
- case kGraphics_font_IPAPALATINO: { [attributes setObject: @"Charis SIL" forKey: (id) kCTFontNameAttribute]; } break;
- case kGraphics_font_DINGBATS: { [attributes setObject: @"Zapf Dingbats" forKey: (id) kCTFontNameAttribute]; } break;
- }
- CTFontDescriptorRef ctFontDescriptor = CTFontDescriptorCreateWithAttributes ((CFMutableDictionaryRef) attributes);
- [styleDict release];
- [attributes release];
- #endif
- ctFont = CTFontCreateWithFontDescriptor (ctFontDescriptor, lc -> size, nullptr);
- CFRelease (ctFontDescriptor);
- theScreenFonts [font] [lc -> size] [style] = ctFont;
- }
+ if (! ctFont)
+ theScreenFonts [font] [lc -> size] [style] = ctFont =
+ quartz_getFontRef (font, lc -> size, style);
const char16 *codes16 = Melder_peek32to16 (codes);
#if 1
@@ -775,12 +814,9 @@ static void charDraw (Graphics anyGraphics, int xDC, int yDC, _Graphics_widechar
CFRange textRange = CFRangeMake (0, length);
CFAttributedStringSetAttribute (string, textRange, kCTFontAttributeName, ctFont);
- static CFNumberRef cfKerning;
- if (! cfKerning) {
- const double kerning = 0.0;
- cfKerning = CFNumberCreate (kCFAllocatorDefault, kCFNumberDoubleType, & kerning);
- }
- CFAttributedStringSetAttribute (string, textRange, kCTKernAttributeName, cfKerning);
+ /*
+ We don't set kerning explicitly, so that Praat will use standard kerning.
+ */
static CTParagraphStyleRef paragraphStyle;
if (! paragraphStyle) {
@@ -889,40 +925,6 @@ static void charSizes (Graphics me, _Graphics_widechar string [], bool measureEa
int style = lc -> style;
Melder_assert (style >= 0 && style <= Graphics_BOLD_ITALIC);
- #if quartz
- /*
- Determine and store the font-style combination.
- */
- CTFontRef ctFont = theScreenFonts [font] [100] [style];
- if (! ctFont) {
- CTFontSymbolicTraits ctStyle = ( style & Graphics_BOLD ? kCTFontBoldTrait : 0 ) | ( lc -> style & Graphics_ITALIC ? kCTFontItalicTrait : 0 );
- NSMutableDictionary *styleDict = [[NSMutableDictionary alloc] initWithCapacity: 1];
- [styleDict setObject: [NSNumber numberWithUnsignedInt: ctStyle] forKey: (id) kCTFontSymbolicTrait];
- NSMutableDictionary *attributes = [[NSMutableDictionary alloc] initWithCapacity: 2];
- [attributes setObject: styleDict forKey: (id) kCTFontTraitsAttribute];
- switch (font) {
- case (int) kGraphics_font::TIMES: { [attributes setObject: @"Times" forKey: (id) kCTFontNameAttribute]; } break;
- case (int) kGraphics_font::HELVETICA: { [attributes setObject: @"Arial" forKey: (id) kCTFontNameAttribute]; } break;
- case (int) kGraphics_font::COURIER: { [attributes setObject: @"Courier New" forKey: (id) kCTFontNameAttribute]; } break;
- case (int) kGraphics_font::PALATINO: { if (Melder_debug == 900)
- [attributes setObject: @"DG Meta Serif Science" forKey: (id) kCTFontNameAttribute];
- else
- [attributes setObject: @"Palatino" forKey: (id) kCTFontNameAttribute];
- } break;
- case kGraphics_font_SYMBOL: { [attributes setObject: @"Symbol" forKey: (id) kCTFontNameAttribute]; } break;
- case kGraphics_font_IPATIMES: { [attributes setObject: @"Doulos SIL" forKey: (id) kCTFontNameAttribute]; } break;
- case kGraphics_font_IPAPALATINO: { [attributes setObject: @"Charis SIL" forKey: (id) kCTFontNameAttribute]; } break;
- case kGraphics_font_DINGBATS: { [attributes setObject: @"Zapf Dingbats" forKey: (id) kCTFontNameAttribute]; } break;
- }
- CTFontDescriptorRef ctFontDescriptor = CTFontDescriptorCreateWithAttributes ((CFMutableDictionaryRef) attributes);
- [styleDict release];
- [attributes release];
- ctFont = CTFontCreateWithFontDescriptor (ctFontDescriptor, 100.0, nullptr);
- CFRelease (ctFontDescriptor);
- theScreenFonts [font] [100] [style] = ctFont;
- }
- #endif
-
int normalSize = my fontSize * my resolution / 72.0;
int smallSize = (3 * normalSize + 2) / 4;
int size = ( lc -> size < 100 ? smallSize : normalSize );
@@ -930,9 +932,18 @@ static void charSizes (Graphics me, _Graphics_widechar string [], bool measureEa
lc -> baseline *= 0.01 * normalSize;
lc -> code = lc -> kar;
lc -> font.integer_ = font;
- if (Longchar_Info_isDiacritic (info)) {
+ if (Longchar_Info_isDiacritic (info))
numberOfDiacritics ++;
- }
+
+ #if quartz
+ /*
+ Determine and store the font-style combination.
+ */
+ CTFontRef ctFont = theScreenFonts [font] [size] [style];
+ if (! ctFont)
+ theScreenFonts [font] [size] [style] = ctFont =
+ quartz_getFontRef (font, size, style);
+ #endif
}
int nchars = 0;
for (_Graphics_widechar *lc = string; lc -> kar > U'\t'; lc ++) {
@@ -988,7 +999,7 @@ static void charSizes (Graphics me, _Graphics_widechar string [], bool measureEa
CFMutableAttributedStringRef cfstring =
CFAttributedStringCreateMutable (kCFAllocatorDefault, (CFIndex) [s length]);
CFAttributedStringReplaceString (cfstring, CFRangeMake (0, 0), (CFStringRef) s);
- CFAttributedStringSetAttribute (cfstring, textRange, kCTFontAttributeName, theScreenFonts [lc -> font.integer_] [100] [lc -> style]);
+ CFAttributedStringSetAttribute (cfstring, textRange, kCTFontAttributeName, theScreenFonts [lc -> font.integer_] [lc -> size] [lc -> style]);
/*
* Measure.
@@ -1010,7 +1021,7 @@ static void charSizes (Graphics me, _Graphics_widechar string [], bool measureEa
//Longchar_Info info = lc -> karInfo;
//bool isDiacritic = ( info -> ps.times == 0 );
//lc -> width = ( isDiacritic ? 0.0 : frameSize.width * lc -> size / 100.0 );
- lc -> width = frameSize.width * lc -> size / 100.0;
+ lc -> width = frameSize.width /* * lc -> size / 100.0 */;
if (Melder_systemVersion >= 101100) {
/*
* If the text ends in a space, CTFramesetterSuggestFrameSizeWithConstraints() ignores the space.
=====================================
sys/GuiDrawingArea.cpp
=====================================
@@ -36,12 +36,13 @@ Thing_implement (GuiDrawingArea, GuiControl, 0);
#endif
#if gtk
- static void _GuiGtkDrawingArea_destroyCallback (GuiObject widget, gpointer void_me) {
+#pragma mark - GTK CALLBACKS (WITH CAIRO)
+ static void _guiGtkDrawingArea_destroyCallback (GuiObject widget, gpointer void_me) {
(void) widget;
iam (GuiDrawingArea);
forget (me);
}
- static gboolean _GuiGtkDrawingArea_drawCallback (GuiObject widget, cairo_t *cairoGraphicsContext, gpointer void_me) {
+ static gboolean _guiGtkDrawingArea_drawCallback (GuiObject widget, cairo_t *cairoGraphicsContext, gpointer void_me) {
trace (U"begin");
iam (GuiDrawingArea);
Melder_assert (me);
@@ -67,7 +68,7 @@ Thing_implement (GuiDrawingArea, GuiControl, 0);
return false;
}
static structGuiDrawingArea_MouseEvent::Phase previousPhase = structGuiDrawingArea_MouseEvent::Phase::DROP;
- static gboolean _GuiGtkDrawingArea_mouseDownCallback (GuiObject widget, GdkEvent *e, gpointer void_me) {
+ static gboolean _guiGtkDrawingArea_mouseDownCallback (GuiObject widget, GdkEvent *e, gpointer void_me) {
iam (GuiDrawingArea);
if (my mouseCallback) {
structGuiDrawingArea_MouseEvent event { me, 0 };
@@ -99,7 +100,7 @@ Thing_implement (GuiDrawingArea, GuiControl, 0);
}
return false;
}
- static gboolean _GuiGtkDrawingArea_mouseDraggedCallback (GuiObject widget, GdkEvent *e, gpointer void_me) {
+ static gboolean _guiGtkDrawingArea_mouseDraggedCallback (GuiObject widget, GdkEvent *e, gpointer void_me) {
iam (GuiDrawingArea);
if (my mouseCallback) {
structGuiDrawingArea_MouseEvent event { me, 0 };
@@ -118,7 +119,7 @@ Thing_implement (GuiDrawingArea, GuiControl, 0);
}
return false;
}
- static gboolean _GuiGtkDrawingArea_mouseUpCallback (GuiObject widget, GdkEvent *e, gpointer void_me) {
+ static gboolean _guiGtkDrawingArea_mouseUpCallback (GuiObject widget, GdkEvent *e, gpointer void_me) {
iam (GuiDrawingArea);
if (my mouseCallback) {
structGuiDrawingArea_MouseEvent event { me, 0 };
@@ -137,7 +138,7 @@ Thing_implement (GuiDrawingArea, GuiControl, 0);
}
return false;
}
- static gboolean _GuiGtkDrawingArea_keyCallback (GuiObject widget, GdkEvent *gevent, gpointer void_me) {
+ static gboolean _guiGtkDrawingArea_keyCallback (GuiObject widget, GdkEvent *gevent, gpointer void_me) {
iam (GuiDrawingArea);
trace (U"begin");
if (my d_keyCallback && gevent -> type == GDK_KEY_PRESS) {
@@ -167,7 +168,7 @@ Thing_implement (GuiDrawingArea, GuiControl, 0);
}
return false; // if the drawing area has no keyCallback, the system will send the key press to a text field.
}
- static gboolean _GuiGtkDrawingArea_resizeCallback (GuiObject widget, GtkAllocation *allocation, gpointer void_me) {
+ static gboolean _guiGtkDrawingArea_resizeCallback (GuiObject widget, GtkAllocation *allocation, gpointer void_me) {
iam (GuiDrawingArea);
if (my d_resizeCallback) {
structGuiDrawingArea_ResizeEvent event { me, 0 };
@@ -184,7 +185,41 @@ Thing_implement (GuiDrawingArea, GuiControl, 0);
}
return false;
}
+ static gboolean _guiGtkDrawingArea_swipeCallback (GuiObject w, GdkEventScroll *event, gpointer void_me) {
+ iam (GuiDrawingArea);
+ trace (U"_guiGtkDrawingArea_swipeCallback ", Melder_pointer (my d_horizontalScrollBar), Melder_pointer (my d_verticalScrollBar));
+ if (my d_horizontalScrollBar) {
+ double hv = gtk_range_get_value (GTK_RANGE (my d_horizontalScrollBar -> d_widget));
+ GtkAdjustment *adjustment = gtk_range_get_adjustment (GTK_RANGE (my d_horizontalScrollBar -> d_widget));
+ gdouble hi;
+ g_object_get (adjustment, "step_increment", & hi, nullptr);
+ switch (event -> direction) {
+ case GDK_SCROLL_LEFT:
+ gtk_range_set_value (GTK_RANGE (my d_horizontalScrollBar -> d_widget), hv - hi);
+ break;
+ case GDK_SCROLL_RIGHT:
+ gtk_range_set_value (GTK_RANGE (my d_horizontalScrollBar -> d_widget), hv + hi);
+ break;
+ }
+ }
+ if (my d_verticalScrollBar) {
+ double vv = gtk_range_get_value (GTK_RANGE (my d_verticalScrollBar -> d_widget));
+ GtkAdjustment *adjustment = gtk_range_get_adjustment (GTK_RANGE (my d_verticalScrollBar -> d_widget));
+ gdouble vi;
+ g_object_get (adjustment, "step_increment", & vi, nullptr);
+ switch (event -> direction) {
+ case GDK_SCROLL_UP:
+ gtk_range_set_value (GTK_RANGE (my d_verticalScrollBar -> d_widget), vv - vi);
+ break;
+ case GDK_SCROLL_DOWN:
+ gtk_range_set_value (GTK_RANGE (my d_verticalScrollBar -> d_widget), vv + vi);
+ break;
+ }
+ }
+ return true;
+ }
#elif motif
+#pragma mark - MOTIF CALLBACKS (WITH GDI)
void _GuiWinDrawingArea_destroy (GuiObject widget) {
iam_drawingarea;
DestroyWindow (widget -> window);
@@ -279,6 +314,7 @@ Thing_implement (GuiDrawingArea, GuiControl, 0);
}
}
#elif cocoa
+#pragma mark - COCOA CALLBACKS (WITH QUARTZ)
@interface GuiCocoaDrawingArea ()
@property (nonatomic, assign) BOOL inited;
@property (nonatomic, retain) NSTrackingArea *trackingArea;
@@ -343,11 +379,21 @@ Thing_implement (GuiDrawingArea, GuiControl, 0);
Melder_casual (U"\t", Thing_messageNameAndAddress (me), U" draw for ", Melder_pointer (my d_exposeBoss));
try {
Melder_assert (my numberOfGraphicses > 0);
- for (integer igraphics = 1; igraphics <= my numberOfGraphicses; igraphics ++)
- GraphicsQuartz_initDraw (my graphicses [igraphics]);
+ for (integer igraphics = 1; igraphics <= my numberOfGraphicses; igraphics ++) {
+ GraphicsScreen graphics = static_cast <GraphicsScreen> (my graphicses [igraphics]);
+ if (graphics -> d_macView) {
+ graphics -> d_macGraphicsContext = Melder_systemVersion < 101400 ?
+ (CGContextRef) [[NSGraphicsContext currentContext] graphicsPort] :
+ [[NSGraphicsContext currentContext] CGContext];
+ Melder_assert (!! graphics -> d_macGraphicsContext);
+ }
+ }
my d_exposeCallback (my d_exposeBoss, & event);
- for (integer igraphics = 1; igraphics <= my numberOfGraphicses; igraphics ++)
- GraphicsQuartz_exitDraw (my graphicses [igraphics]);
+ for (integer igraphics = 1; igraphics <= my numberOfGraphicses; igraphics ++) {
+ GraphicsScreen graphics = static_cast <GraphicsScreen> (my graphicses [igraphics]);
+ if (graphics -> d_macView)
+ graphics -> d_macGraphicsContext = nullptr;
+ }
} catch (MelderError) {
Melder_flushError (U"Redrawing not completed");
}
@@ -472,49 +518,12 @@ Thing_implement (GuiDrawingArea, GuiControl, 0);
@end
#endif
-#if gtk
- static gboolean _guiGtkDrawingArea_swipeCallback (GuiObject w, GdkEventScroll *event, gpointer void_me) {
- iam (GuiDrawingArea);
- trace (U"_guiGtkDrawingArea_swipeCallback ", Melder_pointer (my d_horizontalScrollBar), Melder_pointer (my d_verticalScrollBar));
- if (my d_horizontalScrollBar) {
- double hv = gtk_range_get_value (GTK_RANGE (my d_horizontalScrollBar -> d_widget));
- GtkAdjustment *adjustment = gtk_range_get_adjustment (GTK_RANGE (my d_horizontalScrollBar -> d_widget));
- gdouble hi;
- g_object_get (adjustment, "step_increment", & hi, nullptr);
- switch (event -> direction) {
- case GDK_SCROLL_LEFT:
- gtk_range_set_value (GTK_RANGE (my d_horizontalScrollBar -> d_widget), hv - hi);
- break;
- case GDK_SCROLL_RIGHT:
- gtk_range_set_value (GTK_RANGE (my d_horizontalScrollBar -> d_widget), hv + hi);
- break;
- }
- }
- if (my d_verticalScrollBar) {
- double vv = gtk_range_get_value (GTK_RANGE (my d_verticalScrollBar -> d_widget));
- GtkAdjustment *adjustment = gtk_range_get_adjustment (GTK_RANGE (my d_verticalScrollBar -> d_widget));
- gdouble vi;
- g_object_get (adjustment, "step_increment", & vi, nullptr);
- switch (event -> direction) {
- case GDK_SCROLL_UP:
- gtk_range_set_value (GTK_RANGE (my d_verticalScrollBar -> d_widget), vv - vi);
- break;
- case GDK_SCROLL_DOWN:
- gtk_range_set_value (GTK_RANGE (my d_verticalScrollBar -> d_widget), vv + vi);
- break;
- }
- }
- return true;
- }
-#endif
-
void structGuiDrawingArea :: v_destroy () noexcept {
if (Melder_debug == 55)
Melder_casual (U"\t", Thing_messageNameAndAddress (this), U" v_destroy");
#if cocoa
- if (our d_widget) {
+ if (our d_widget)
[our d_widget setUserData: nullptr]; // undangle reference to this
- }
#endif
GuiDrawingArea_Parent :: v_destroy ();
}
@@ -548,18 +557,18 @@ GuiDrawingArea GuiDrawingArea_create (GuiForm parent, int left, int right, int t
| GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK
| GDK_POINTER_MOTION_HINT_MASK); // receive fewer motion notify events (the cb might take time)
gtk_widget_set_events (GTK_WIDGET (my d_widget), mask);
- g_signal_connect (G_OBJECT (my d_widget), "draw", G_CALLBACK (_GuiGtkDrawingArea_drawCallback), me.get());
- g_signal_connect (G_OBJECT (my d_widget), "destroy", G_CALLBACK (_GuiGtkDrawingArea_destroyCallback), me.get());
- g_signal_connect (G_OBJECT (my d_widget), "button-press-event", G_CALLBACK (_GuiGtkDrawingArea_mouseDownCallback), me.get());
- g_signal_connect (G_OBJECT (my d_widget), "button-release-event", G_CALLBACK (_GuiGtkDrawingArea_mouseUpCallback), me.get());
- //g_signal_connect (G_OBJECT (my d_widget), "drag-motion-event", G_CALLBACK (_GuiGtkDrawingArea_mouseUpCallback), me.get());
- g_signal_connect (G_OBJECT (my d_widget), "motion-notify-event", G_CALLBACK (_GuiGtkDrawingArea_mouseDraggedCallback), me.get());
+ g_signal_connect (G_OBJECT (my d_widget), "draw", G_CALLBACK (_guiGtkDrawingArea_drawCallback), me.get());
+ g_signal_connect (G_OBJECT (my d_widget), "destroy", G_CALLBACK (_guiGtkDrawingArea_destroyCallback), me.get());
+ g_signal_connect (G_OBJECT (my d_widget), "button-press-event", G_CALLBACK (_guiGtkDrawingArea_mouseDownCallback), me.get());
+ g_signal_connect (G_OBJECT (my d_widget), "button-release-event", G_CALLBACK (_guiGtkDrawingArea_mouseUpCallback), me.get());
+ //g_signal_connect (G_OBJECT (my d_widget), "drag-motion-event", G_CALLBACK (_guiGtkDrawingArea_mouseUpCallback), me.get());
+ g_signal_connect (G_OBJECT (my d_widget), "motion-notify-event", G_CALLBACK (_guiGtkDrawingArea_mouseDraggedCallback), me.get());
if (parent) {
Melder_assert (parent -> d_widget);
g_signal_connect (G_OBJECT (gtk_widget_get_toplevel (GTK_WIDGET (parent -> d_widget))), "key-press-event",
- G_CALLBACK (_GuiGtkDrawingArea_keyCallback), me.get());
+ G_CALLBACK (_guiGtkDrawingArea_keyCallback), me.get());
}
- g_signal_connect (G_OBJECT (my d_widget), "size-allocate", G_CALLBACK (_GuiGtkDrawingArea_resizeCallback), me.get());
+ g_signal_connect (G_OBJECT (my d_widget), "size-allocate", G_CALLBACK (_guiGtkDrawingArea_resizeCallback), me.get());
_GuiObject_setUserData (my d_widget, me.get());
my v_positionInForm (my d_widget, left, right, top, bottom, parent);
@@ -627,16 +636,16 @@ GuiDrawingArea GuiDrawingArea_create (GuiScrolledWindow parent, int width, int h
| GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK
| GDK_POINTER_MOTION_HINT_MASK); // receive fewer motion notify events (the cb might take time)
gtk_widget_set_events (GTK_WIDGET (my d_widget), mask);
- g_signal_connect (G_OBJECT (my d_widget), "draw", G_CALLBACK (_GuiGtkDrawingArea_drawCallback), me.get());
- g_signal_connect (G_OBJECT (my d_widget), "destroy", G_CALLBACK (_GuiGtkDrawingArea_destroyCallback), me.get());
- g_signal_connect (G_OBJECT (my d_widget), "button-press-event", G_CALLBACK (_GuiGtkDrawingArea_mouseDownCallback), me.get());
- g_signal_connect (G_OBJECT (my d_widget), "button-release-event", G_CALLBACK (_GuiGtkDrawingArea_mouseUpCallback), me.get());
- g_signal_connect (G_OBJECT (my d_widget), "motion-notify-event", G_CALLBACK (_GuiGtkDrawingArea_mouseDraggedCallback), me.get());
+ g_signal_connect (G_OBJECT (my d_widget), "draw", G_CALLBACK (_guiGtkDrawingArea_drawCallback), me.get());
+ g_signal_connect (G_OBJECT (my d_widget), "destroy", G_CALLBACK (_guiGtkDrawingArea_destroyCallback), me.get());
+ g_signal_connect (G_OBJECT (my d_widget), "button-press-event", G_CALLBACK (_guiGtkDrawingArea_mouseDownCallback), me.get());
+ g_signal_connect (G_OBJECT (my d_widget), "button-release-event", G_CALLBACK (_guiGtkDrawingArea_mouseUpCallback), me.get());
+ g_signal_connect (G_OBJECT (my d_widget), "motion-notify-event", G_CALLBACK (_guiGtkDrawingArea_mouseDraggedCallback), me.get());
if (parent) {
g_signal_connect (G_OBJECT (gtk_widget_get_toplevel (GTK_WIDGET (parent -> d_widget))), "key-press-event",
- G_CALLBACK (_GuiGtkDrawingArea_keyCallback), me.get());
+ G_CALLBACK (_guiGtkDrawingArea_keyCallback), me.get());
}
- g_signal_connect (G_OBJECT (my d_widget), "size-allocate", G_CALLBACK (_GuiGtkDrawingArea_resizeCallback), me.get());
+ g_signal_connect (G_OBJECT (my d_widget), "size-allocate", G_CALLBACK (_guiGtkDrawingArea_resizeCallback), me.get());
_GuiObject_setUserData (my d_widget, me.get());
my v_positionInScrolledWindow (my d_widget, width, height, parent);
#elif motif
=====================================
sys/GuiMenu.cpp
=====================================
@@ -48,6 +48,15 @@ void structGuiMenu :: v_destroy () noexcept {
trace (U"destroying GuiButton ", Melder_pointer (my d_cascadeButton.get()));
gtk_widget_destroy (GTK_WIDGET (my d_widget));
}
+ static gint _guiGtkMenuCascadeButton_buttonCallback (GtkWidget *gtkMenu, GdkEvent *gdkEvent) {
+ if (gdkEvent -> type == GDK_BUTTON_PRESS) {
+ GtkWidget *gtkCascadeButton = (GtkWidget *) g_object_get_data (G_OBJECT (gtkMenu), "button");
+ gtk_menu_popup_at_widget (GTK_MENU (gtkMenu), GTK_WIDGET (gtkCascadeButton),
+ GDK_GRAVITY_SOUTH_WEST, GDK_GRAVITY_NORTH_WEST, gdkEvent);
+ return true;
+ }
+ return false;
+ }
#elif motif
static void _guiMotifMenu_destroyCallback (GuiObject widget, XtPointer void_me, XtPointer call) {
(void) void_me;
@@ -344,7 +353,7 @@ GuiMenu GuiMenu_createInWindow (GuiWindow window, conststring32 title, uint32 fl
_GuiObject_setUserData (my d_widget, me.get());
#elif cocoa
if (! theMenuBar) {
- int numberOfMenus = [[[NSApp mainMenu] itemArray] count];
+ integer numberOfMenus = uinteger_to_integer ([[[NSApp mainMenu] itemArray] count]);
trace (U"Number of menus: ", numberOfMenus);
[NSApp setDelegate: NSApp]; // the app is its own delegate
theMenuBar = [[NSMenu alloc] init];
@@ -363,10 +372,10 @@ GuiMenu GuiMenu_createInWindow (GuiWindow window, conststring32 title, uint32 fl
*/
NSString *itemTitle = (NSString *) Melder_peek32toCfstring (title);
my d_cocoaMenuItem = [[GuiCocoaMenuItem alloc]
- initWithTitle: itemTitle action: nullptr keyEquivalent: @""];
+ initWithTitle: itemTitle action: nullptr keyEquivalent: @""];
[my d_cocoaMenuItem setSubmenu: my d_cocoaMenu]; // the item will retain the menu...
- [my d_cocoaMenu release]; // ... so we can release the menu already (before even returning it!)
+ [my d_cocoaMenu release]; // ... so we can release the menu already (before even returning it!)
theMenuBarItems [++ theNumberOfMenuBarItems] = my d_cocoaMenuItem;
} else if ([(NSView *) window -> d_widget isKindOfClass: [NSView class]]) {
/*
@@ -395,7 +404,7 @@ GuiMenu GuiMenu_createInWindow (GuiWindow window, conststring32 title, uint32 fl
//[nsPopupButton setBordered: NO];
[my d_cocoaMenuButton setAutoresizingMask: resizingMask]; // stick to top
if (flags & GuiMenu_INSENSITIVE)
- [my d_cocoaMenuButton setEnabled: NO];
+ [my d_cocoaMenuButton setEnabled: NO];
[[my d_cocoaMenuButton cell] setArrowPosition: NSPopUpNoArrow /*NSPopUpArrowAtBottom*/];
[[my d_cocoaMenuButton cell] setPreferredEdge: NSMaxYEdge];
@@ -465,7 +474,7 @@ GuiMenu GuiMenu_createInMenu (GuiMenu supermenu, conststring32 title, uint32 fla
action: nullptr
keyEquivalent: @""];
trace (U"adding the item to its supermenu ", Melder_pointer (supermenu));
- [supermenu -> d_cocoaMenu addItem: item]; // the menu will retain the item...
+ [supermenu -> d_cocoaMenu addItem: item]; // the menu will retain the item...
trace (U"release the item");
[item release]; // ... so we can release the item already
trace (U"creating menu ", title);
@@ -476,7 +485,7 @@ GuiMenu GuiMenu_createInMenu (GuiMenu supermenu, conststring32 title, uint32 fla
trace (U"adding the new menu ", Melder_pointer (me.get()), U" to its supermenu ", Melder_pointer (supermenu));
[supermenu -> d_cocoaMenu setSubmenu: my d_cocoaMenu forItem: item]; // the supermenu will retain the menu...
Melder_assert ([my d_cocoaMenu retainCount] == 2);
- [my d_cocoaMenu release]; // ... so we can release the menu already, even before returning it
+ [my d_cocoaMenu release]; // ... so we can release the menu already, even before returning it
my d_widget = my d_cocoaMenu;
my d_menuItem -> d_widget = (GuiObject) item;
#endif
@@ -490,40 +499,6 @@ GuiMenu GuiMenu_createInMenu (GuiMenu supermenu, conststring32 title, uint32 fla
return me.releaseToAmbiguousOwner();
}
-#if gtk
- static void set_position (GtkMenu *menu, gint *px, gint *py, gpointer data)
- {
- //gint w, h;
- GtkWidget *button = (GtkWidget *) g_object_get_data (G_OBJECT (menu), "button");
- GtkAllocation button_allocation;
- gtk_widget_get_allocation (GTK_WIDGET (button), & button_allocation);
- GtkRequisition menu_requisition;
- gtk_widget_get_child_requisition (GTK_WIDGET (menu), & menu_requisition);
- //if (GTK_WIDGET (menu) -> requisition. width < button_allocation.width)
- if (menu_requisition. width < button_allocation.width)
- gtk_widget_set_size_request (GTK_WIDGET (menu), button_allocation.width, -1);
-
- gdk_window_get_origin (gtk_widget_get_window (button), px, py);
- *px += button_allocation.x;
- *py += button_allocation.y + button_allocation.height; /* Dit is vreemd */
-
- }
- static gint button_press (GtkWidget *widget, GdkEvent *event)
- {
- /* GtkWidget *button = (GtkWidget *) g_object_get_data (G_OBJECT (widget), "button");
- gint w, h;
- gdk_window_get_size (button->window, &w, &h);
- gtk_widget_set_usize (widget, w, 0);*/
-
- if (event->type == GDK_BUTTON_PRESS) {
- GdkEventButton *bevent = (GdkEventButton *) event;
- gtk_menu_popup (GTK_MENU (widget), nullptr, nullptr, (GtkMenuPositionFunc) set_position, nullptr, bevent->button, bevent->time);
- return true;
- }
- return false;
- }
-#endif
-
GuiMenu GuiMenu_createInForm (GuiForm form, int left, int right, int top, int bottom, conststring32 title, uint32 flags) {
autoGuiMenu me = Thing_new (GuiMenu);
my d_shell = form -> d_shell;
@@ -541,9 +516,9 @@ GuiMenu GuiMenu_createInForm (GuiForm form, int left, int right, int top, int bo
if (flags & GuiMenu_INSENSITIVE)
gtk_widget_set_sensitive (GTK_WIDGET (my d_widget), false);
- g_signal_connect_object (G_OBJECT (my d_cascadeButton -> d_widget), "event",
- G_CALLBACK (button_press), G_OBJECT (my d_widget), G_CONNECT_SWAPPED);
g_object_set_data (G_OBJECT (my d_widget), "button", my d_cascadeButton -> d_widget);
+ g_signal_connect_object (G_OBJECT (my d_cascadeButton -> d_widget), "event",
+ G_CALLBACK (_guiGtkMenuCascadeButton_buttonCallback), G_OBJECT (my d_widget), G_CONNECT_SWAPPED);
gtk_menu_attach_to_widget (GTK_MENU (my d_widget), GTK_WIDGET (my d_cascadeButton -> d_widget), nullptr);
gtk_button_set_alignment (GTK_BUTTON (my d_cascadeButton -> d_widget), 0.5f, 0.5f);
_GuiObject_setUserData (my d_widget, me.get());
@@ -571,7 +546,7 @@ GuiMenu GuiMenu_createInForm (GuiForm form, int left, int right, int top, int bo
[[my d_cocoaMenuButton cell] setArrowPosition: NSPopUpNoArrow /*NSPopUpArrowAtBottom*/];
NSString *menuTitle = (NSString*) Melder_peek32toCfstring (title);
- my d_widget = my d_cocoaMenu = [[GuiCocoaMenu alloc] initWithTitle:menuTitle];
+ my d_widget = my d_cocoaMenu = [[GuiCocoaMenu alloc] initWithTitle: menuTitle];
[my d_cocoaMenu setAutoenablesItems: NO];
/*
Apparently, Cocoa swallows title setting only if there is already a menu with a dummy item.
=====================================
sys/praat_picture.cpp
=====================================
@@ -45,8 +45,10 @@ static GuiMenuItem praatButton_fonts [1 + (int) kGraphics_font::MAX];
static void updateFontMenu () {
if (! theCurrentPraatApplication -> batch) {
- if (theCurrentPraatPicture -> font < (int) kGraphics_font::MIN) theCurrentPraatPicture -> font = (int) kGraphics_font::MIN;
- if (theCurrentPraatPicture -> font > (int) kGraphics_font::MAX) theCurrentPraatPicture -> font = (int) kGraphics_font::MAX;
+ if (theCurrentPraatPicture -> font < (int) kGraphics_font::MIN)
+ theCurrentPraatPicture -> font = (int) kGraphics_font::MIN;
+ if (theCurrentPraatPicture -> font > (int) kGraphics_font::MAX)
+ theCurrentPraatPicture -> font = (int) kGraphics_font::MAX;
for (int i = (int) kGraphics_font::MIN; i <= (int) kGraphics_font::MAX; i ++) {
GuiMenuItem_check (praatButton_fonts [i], theCurrentPraatPicture -> font == i);
}
=====================================
sys/praat_version.h
=====================================
@@ -1,5 +1,5 @@
-#define PRAAT_VERSION_STR 6.1.33
-#define PRAAT_VERSION_NUM 6133
+#define PRAAT_VERSION_STR 6.1.34
+#define PRAAT_VERSION_NUM 6134
#define PRAAT_YEAR 2020
#define PRAAT_MONTH November
-#define PRAAT_DAY 19
+#define PRAAT_DAY 25
View it on GitLab: https://salsa.debian.org/med-team/praat/-/compare/07a2d79fbe56fe0be68e115b548228e935f4ffd4...e361c9ef2b41bd2a409ed5fc25f6a671186ab141
--
View it on GitLab: https://salsa.debian.org/med-team/praat/-/compare/07a2d79fbe56fe0be68e115b548228e935f4ffd4...e361c9ef2b41bd2a409ed5fc25f6a671186ab141
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20201126/feb4ee4c/attachment-0001.html>
More information about the debian-med-commit
mailing list