TweetFollow Us on Twitter

Sep 98 Tips

Volume Number: 14 (1998)
Issue Number: 9
Column Tag: Tips & Tidbits

Sep 1998 Tips & Tidbits

by Steve Sisak

Smarter ZoomWindows

Here's a painless substitute for ZoomWindow. I originally wrote the SmartZoomWindow wrapper to add multiple monitor support to ZoomWindow. Recently I tweaked the code to compensate for Mac OS 8 "fat borders" (actually it should work correctly with any WDEF geometry.)

I inset the zoom out by 3 pixels. I do this because some displays still have rounded corners that will crop the window's corners. Additionally I like to leave a small gap around the edge of a window so I can click into the Finder. If you desired to adjoin the window with the Menubar and display edges set kInsetZoomOut to zero.

Remember to compensate for "fat borders" in your window position and window staggering routines.

Public Interface
   enum {
      kInsetZoomOut = 3
   };

   void SmartZoomWindow(
         WindowPtr targetWindow,
         short partCode,
         Boolean bringFront);

Implementation
static void 
_LocalToGlobalRect(
   Rect *targetRect)
{
   LocalToGlobal((Point*)(&targetRect->top));
   LocalToGlobal((Point*)(&targetRect->bottom));
}

void SmartZoomWindow(
   WindowPtr targetWindow,
   short partCode,
   Boolean front)
{
   GrafPtr savePort;
   GDHandle dstGDevice;
   GDHandle testGDevice;
   Rect srcRect;
   Rect dstRect;
   Rect testRect;
   long dstArea;
   long testArea;
   short titleHeight;
   short borderWidth;

   if(targetWindow)
   {
      GetPort(&savePort);
      SetPort(targetWindow);

      if(partCode == inZoomOut)
      {
         srcRect = targetWindow->portRect;
         _LocalToGlobalRect(&srcRect);
         titleHeight = srcRect.top - 1 -
            (*((WindowPeek)targetWindow)->strucRgn)->rgnBBox.top;
         borderWidth = srcRect.left - 1 -
            (*((WindowPeek)targetWindow)->strucRgn)->rgnBBox.left;
         srcRect.top -= titleHeight;
         dstArea = 0;
         testGDevice = GetDeviceList();

         while(testGDevice)
         {
            if(TestDeviceAttribute(testGDevice, screenDevice))
            {
               if(TestDeviceAttribute(testGDevice, screenActive))
               {
                  SectRect(&srcRect, & (*testGDevice)->gdRect,
                                               &testRect);
                  testArea = (long)(testRect.right - testRect.left) *
                              (long)(testRect.bottom - testRect.top);
                  if(testArea > dstArea)
                  {
                     dstGDevice = testGDevice;
                     dstArea = testArea;
                  }
               }
            }

            testGDevice = GetNextDevice(testGDevice);
         }

         if(dstGDevice == GetMainDevice())
         {
            titleHeight += GetMBarHeight();
         }

         dstRect = (*dstGDevice)->gdRect;
         dstRect.top += titleHeight + kInsetZoomOut;
         dstRect.left += borderWidth + kInsetZoomOut;
         dstRect.right -= borderWidth + kInsetZoomOut;
         dstRect.bottom -= borderWidth + kInsetZoomOut;
         (*(WStateDataHandle)((WindowPeek)targetWindow)-
                            >dataHandle)->stdState = dstRect;
      }

      ZoomWindow(targetWindow, partCode, front);

      SetPort(savePort);
   }
}

Craig Marciniak
craig@marciniac.com

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

OmniOutliner Pro 4.2 - Pro version of th...
OmniOutliner Pro is a flexible program for creating, collecting, and organizing information. Give your creativity a kick start by using an application that's actually designed to help you think. It's... Read more
VLC Media Player 2.2.1 - Popular multime...
VLC Media Player is a highly portable multimedia player for various audio and video formats (MPEG-1, MPEG-2, MPEG-4, DivX, MP3, OGG, ...) as well as DVDs, VCDs, and various streaming protocols. It... Read more
Nisus Writer Pro 2.1.1 - Multilingual wo...
Nisus Writer Pro is a powerful multilingual word processor, similar to its entry level products, but brings new features such as table of contents, indexing, bookmarks, widow and orphan control,... Read more
Tinderbox 6.2.0 - Store and organize you...
Tinderbox is a personal content management assistant. It stores your notes, ideas, and plans. It can help you organize and understand them. And Tinderbox helps you share ideas through Web journals... Read more
OmniOutliner 4.2 - Organize your ideas,...
OmniOutliner is a flexible program for creating, collecting, and organizing information. Give your creativity a kick start by using an application that's actually designed to help you think. It's... Read more
Things 2.5.4 - Elegant personal task man...
Things is a task management solution that helps to organize your tasks in an elegant and intuitive way. Things combines powerful features with simplicity through the use of tags and its intelligent... Read more
NeoOffice 2014.10 - Mac-tailored, OpenOf...
NeoOffice is a complete office suite for OS X. With NeoOffice, users can view, edit, and save OpenOffice documents, PDF files, and most Microsoft Word, Excel, and PowerPoint documents. NeoOffice 3.x... Read more
iPhoto Library Manager 4.2 - Manage mult...
iPhoto Library Manager allows you to organize your photos among multiple iPhoto libraries, rather than having to store all of your photos in one giant library. You can browse the photos in all your... Read more
Web Snapper 3.3.8 - Capture entire Web p...
Web Snapper lets you capture Web pages exactly as they appear in your browser. You can send them to a file as images or vector-based, multi-page PDFs. It captures the whole Web page - eliminating the... Read more
TeamViewer 10.0.41404 - Establish remote...
TeamViewer gives you remote control of any computer or Mac over the Internet within seconds, or can be used for online meetings. Find out why more than 200 million users trust TeamViewer! Free for... Read more

Chainsaw Warrior: Lords of the Night has...
It's time to put the Darkness back in its place now that Chainsaw Warrior: Lords of the Night has officially made it to iOS. | Read more »
A World of Ice and Fire Lets You Stalk 2...
George R. R. Martin’s A World of Ice and Fire, by Random House, is a mobile guide to the epic series. The new update gives you the Journeys map feture that will let you track the movements of 25 different characters. But don't worry, you can protect... | Read more »
Gameloft Announces Battle Odyssey, a New...
Battle Odyssey, Gameloft's newest puzzle RPG, is coming to the App Store next week. Set in the world of Pondera, you will need to control the power of the elements to defend the world from evil. You'll be able to entlist over 500 allies to aid you... | Read more »
Fusion - HDR Camera (Photography)
Fusion - HDR Camera 1.0.0 Device: iOS Universal Category: Photography Price: $1.99, Version: 1.0.0 (iTunes) Description: Fusion creates HDR (high dynamic range) photos by capturing different exposures and then combining them into one... | Read more »
Sago Mini Toolbox (Education)
Sago Mini Toolbox 1.1 Device: iOS Universal Category: Education Price: $2.99, Version: 1.1 (iTunes) Description: Come build with the Sago Mini friends! Use a wrench, try a saw, or hammer some nails. From sewing hand puppets to... | Read more »
You Should Probably Grab Hitman GO While...
Hitman GO is a surprisingly cool (yet also incredibly drastic) departure from the Hitman series. It's well worth playing for any puzzle game fans out there, and at the moment you can get your hands - or garrotte if you will - on it for a mere $0.99... | Read more »
IFTTT is Bringing Do Button and Do Note...
IFTTT has announced Do Button and Do Note for the Apple Watch. Do Button lets you make your own personalized button that can connect to things like your Google Drive, control the temperature in your home with Nest Thermostat, or turn the lights on... | Read more »
How Many Days, Hours, and Minutes Are Le...
Countdown, by Yves Tscherry, is now available on the App Store. The app keeps track of countdowns to your favorite things such as someones birthday or days till the New Year. You can display the time in seconds, minutes, hours, days, weeks, months,... | Read more »
The All-New Misfit 2.0 App is Available...
Misfit has just given their app a complete overhaul. Misfit 2.0 now has a brand new interface with a sleek design and is easier to navigate. You'll be able to sync your Misfit device and look up health and fitness information faster than ever before... | Read more »
Halo: Spartan Strike (Games)
Halo: Spartan Strike 1.0 Device: iOS Universal Category: Games Price: $5.99, Version: 1.0 (iTunes) Description: Delve into 30 challenging missions through cities and jungles using a devastating arsenal of weapons, abilities and... | Read more »

Price Scanner via MacPrices.net

TigerText Introduces First Secure Enterprise...
TigerText, a provider of secure, real-time messaging for the enterprise, has announced the launch of TigerText for the Apple Watch. TigerText for the Apple Watch enables users to securely send and... Read more
The Conservation Fund Partners with Apple To...
The Conservation Fund has announced that it will partner with Apple to help protect working forests in the United States. The Apple initiative will conserve more than 36,000 acres of working... Read more
Clearance 13-inch 2.6GHz Retina MacBook Pro a...
B&H Photo has clearance 2014 13″ 2.6GHz/128GB Retina MacBook Pros now available for $1099, or $200 off original MSRP. Shipping is free, and B&H charges NY sales tax only. Read more
Apple refurbished 2014 13-inch Retina MacBook...
The Apple Store has Apple Certified Refurbished 2014 13″ Retina MacBook Pros available for up to $400 off original MSRP, starting at $979. An Apple one-year warranty is included with each model, and... Read more
iMacs on sale for up to $205 off MSRP, NY tax...
B&H Photo has 21″ and 27″ iMacs on sale for up to $205 off MSRP including free shipping plus NY sales tax only: - 21″ 1.4GHz iMac: $1019 $80 off - 21″ 2.7GHz iMac: $1189 $110 off - 21″ 2.9GHz... Read more
Sale! 16GB iPhone 5S for $1 with service
Best Buy is offering 16GB iPhone 5Ss for $1.00 with 2-year activation at a participating cellular provider. Choose free home shipping and activation, or buy online and activate during in-store pickup... Read more
Apple refurbished 2014 MacBook Airs available...
The Apple Store has Apple Certified Refurbished 2014 MacBook Airs available starting at $679. An Apple one-year warranty is included with each MacBook, and shipping is free. These are currently the... Read more
27-inch 3.5GHz 5K iMac on sale for $2349, sav...
 Adorama has the 27″ 3.5GHz 5K iMac in stock today and on sale for $2349 including free shipping plus NY & NJ sales tax only. Their price is $150 off MSRP. For a limited time, Adorama will... Read more
Save up to $380 on an iMac with Apple refurbi...
The Apple Store has Apple Certified Refurbished iMacs available for up to $380 off the cost of new models. Apple’s one-year warranty is standard, and shipping is free: - 27″ 3.5GHz 5K iMac – $2119 $... Read more
iFixIt Teardown Awards 12-IInch Retina MacBoo...
iFixIt has posted its illustrated teardown of the new 12-inch MacBook Retina. They note that this new MacBook is less than half the thickness of the last Apple notebook called just “MacBook” back in... Read more

Jobs Board

Sr. Payment Program Manager, *Apple* Pay -...
**Job Summary** Apple Pay is an exciting environment and a…devices in a simple, private and secure way. The Apple Pay Team is looking for an experienced Senior Read more
Marketing Program Manager, *Apple* Retail O...
**Job Summary** Imagine what you could do here. At Apple , great ideas have a way of becoming great products, services, and customer experiences very quickly. Bring Read more
Senior Manager, Business Development - *Appl...
**Job Summary** Apple Pay is seeking an experienced business development manager to support the identification, recruitment, negotiation and ongoing management of Read more
*Apple* Pay - Senior Software Engineer - App...
…delight? Do you have a natural curiosity for lea ing new technologies? The Apple Pay server engineering team wants to hear from you. **Key Qualifications** Architect and Read more
Engineering Manager, Search Relevance, *Appl...
Job Description: Job Summary. Apple 's new Spotlight Suggestions service provides fast, relevant search results from the Internet in Spotlight and Safari on iOS and OS X. Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.