eudora-mac/fmtbar.c

1 line
46 KiB
C
Raw Normal View History

2018-05-23 09:59:15 +00:00
/* Copyright (c) 2017, Computer History Museum All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Computer History Museum nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "fmtbar.h" #define FILE_NUM 80 /* Copyright (c) 1990-1992 by the University of Illinois Board of Trustees */ /* MJN *//* new file *//* moved text formatting toolbar code from compact.c to here */ void TFBFontPopupPrepare(MyWindowPtr win, EventRecord* event); void TFBSizePopupPrepare(MyWindowPtr win, EventRecord* event); void TFBColorPopupPrepare(MyWindowPtr win, EventRecord* event); void PlaceTxtFmtBarIcons(MyWindowPtr win,Boolean visible); void GetCurEditorMarginsLo(PETEHandle pte, PSMPtr currentTxtMargin, long paraIndex); #pragma segment CompMng /************************************************************************ * private functions ************************************************************************/ MenuHandle GetSizePopupMenuHdl(void); /* MJN *//* new routine */ void InitTextFormattingBarGlobals(void); /* MJN *//* new routine */ Rect *CompTextFormattingBarIconRect(Rect *r,MessHandle messH,short index); /* MJN *//* new routine */ ControlHandle GetNextCompWindowTFBIcon(MyWindowPtr win,ControlHandle prevControl,long iconTag); /* MJN *//* new routine */ #define NUM_TEXT_BAR_ICONS 15 /* MJN *//* text formatting toolbar */ #define FIRST_TEXT_BTN (ICON_BAR_NUM+10) /* MJN *//* text formatting toolbar */ //SD - moved 10 buttons higher #define LAST_TEXT_BTN (FIRST_TEXT_BTN+NUM_TEXT_BAR_ICONS-1) /* MJN *//* text formatting toolbar */ #define NUM_TEXT_BAR_POPUPS 3 #define FIRST_TEXT_POPUP FIRST_TEXT_BTN+NUM_TEXT_BAR_ICONS #define LAST_TEXT_POPUP (FIRST_TEXT_POPUP+NUM_TEXT_BAR_POPUPS-1) /* MJN *//* text formatting toolbar */ #define TXT_FMT_BAR_ICON_WIDTH 19 #define TXT_FMT_BAR_ICON_HEIGHT 19 #define TFB_IDLE_INTERVAL 15 /* minimum frequency, in ticks, that the text formatting bar should be checked and updated to match the text settings of the current text selection */ static Boolean txtFmtBarGlobalsInitted = false; /* true if InitTextFormattingBarGlobals has been called; used to make sure the globals are only initialized once */ static short tfbHeight; /* height (in pixels) of the text formatting bar */ static Boolean tfbColorPopupEnabled; /* true if the Color popup should appear in the text formatting bar; normally set to false if Color QuickDraw is not present */ static short tfbPopupFontNum; /* font family ID to use for drawing text in the formatting toolbar popups */ static short tfbPopupFontSize; /* font size to use for drawing text in the for