//--------------------------------------------------------------------------- int __fastcall TFileLoadSave::ShowModal(FileNum path,AnsiString& currname,AnsiString& currtitle,FileModes mode) { int i=0; while(dirnums[i] && dirnums[i]!=FileNum(int(path)&0xff00)) i++; if (dirnums[i]==0) { if (path) { CurrDirNum=FileNum(int(path)&0xff00); dirnums[1+1]=CurrDirNum; char pathbuff[80]; char* n=FILEMAN.namenumberedfilelessfail(CurrDirNum); char* c; for (c=n+strlen(n);*c!='\\';--c) *c=0; strcpy(pathbuff,n); return ShowModal(pathbuff,currname,currtitle,mode); } else { i=0; CurrDirNum=dirnums[i]; } } PathList->ItemIndex=i; return ShowModal(PathList->Items->Strings[i],currname,currtitle,mode); }
//--------------------------------------------------------------------------- __fastcall TFileLoadSave::TFileLoadSave(TComponent* Owner) : TForm(Owner) { Font->Color = clWindow; Font->Color = clWindowText; squelchdiscard=false; fakedir=false; PathList->Items->Clear(); int i,f; for (i=0,f=120*256;f<140*256;f+=256) { char* n=FILEMAN.namenumberedfilelessfail(FileNum(f)); if (n) { dirnums[i]=f; char* c; for (c=n+strlen(n);*c!='\\';--c) *c=0; PathList->Items->Add(n); i++; } } while (i<32) dirnums[i++]=0; }
void PackageList::SaveBin() { File_Man.DiscardDirList(FIL_RUNTIMEPACK0); FileNum fnum=FIL_RUNTIMEPACK0; for (int packs=0;packs<Profile::MAX_PACKS;packs++) if (pack[packs][0][0].uid) { BOStream f(File_Man.namenumberedfile(fnum)); SaveBin(&packs[pack],f); fnum=FileNum(fnum+1); } }
void PackageList::SaveBin() { File_Man.DiscardDirList(FIL_RUNTIMEPACK0); BuildReorderTable(); FileNum fnum=FIL_RUNTIMEPACK0; for (int packs=0;packs<Profile::MAX_PACKS;packs++) if (pack[packs].packagestatus!=Profile::PS_SPARE && pack[packs].wpsused) { if (Todays_Packages[packs][0].diaryentry == -1) //RJS 27Jan00 { for (int s=0,max=Todays_Packages[packs].squadlist;s<max;s++) MMC.thisweekreview.Note(Todays_Packages[packs][s].Squadron().AcType(),PeriodReview::SORTIES,Todays_Packages[packs][s].numacoriginal); Squad_Diary.CreateEntry(Todays_Packages,packs); //RJS 27Jan00 } BOStream f(File_Man.namenumberedfile(fnum)); SaveBin(&pack[packs],f); fnum=FileNum(fnum+1); } }
void ReadPrependDef(unsigned typ, OBJECT encl) { OBJECT t, fname; FILE_NUM fnum; t = LexGetToken(); if( type(t) != LBR ) { Error(5, 5, "left brace expected here in %s declaration", WARN, &fpos(t), KW_PREPEND); Dispose(t); return; } fname = Parse(&t, encl, FALSE, FALSE); fname = ReplaceWithTidy(fname, ACAT_TIDY); if( !is_word(type(fname)) ) { Error(5, 6, "name of %s file expected here", WARN, &fpos(fname),KW_PREPEND); DisposeObject(fname); return; } debug0(DFS, D, " calling DefineFile from ReadPrependDef"); fnum = FileNum(string(fname), STR_EMPTY); if( fnum == NO_FILE || FileType(fnum) != PREPEND_FILE ) DefineFile(string(fname), STR_EMPTY, &fpos(fname), PREPEND_FILE, typ == PREPEND ? INCLUDE_PATH : SYSINCLUDE_PATH); } /* end ReadPrependDef */
void CRScrlBarCtrl::OnDraw( CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid) { CWnd* parent; if (m_bDrawing || !m_hWnd) return; m_bDrawing=TRUE; // all the graphics come from the file system and if this is not // available then we cant draw anything // long offsets; if (m_parent) // this contains the closest rdialog if the below case is not true { parent=m_parent; } else { // assumes we are on a listbox with an rdialog underneath it // it will probably break if its placed somewhere on its own... // I tried to set m_parent to be the listboxes parent but // I kept getting stupid errors parent=GetParent()->GetParent(); } CDC* pOffScreenDC=(CDC*)parent->SendMessage(WM_GETOFFSCREENDC,NULL,NULL); ASSERT(pOffScreenDC); // this will fail if parent is not an RDialog // offsets=parent->SendMessage(WM_GETXYOFFSET,NULL,NULL); // this is quite a complex drawing procedure so we are going // to use an offscreen DC to prevent flicker... CBitmap bitmap; bitmap.CreateCompatibleBitmap(pdc,rcBounds.right,rcBounds.bottom); CBitmap* pOldBitmap; pOldBitmap=pOffScreenDC->SelectObject(&bitmap); // ASSERT(pOffScreenDC->GetDeviceCaps(CAPS1)&C1_TRANSPARENT); /* offscreenDC2.CreateCompatibleDC(pdc); CBitmap bitmap2; bitmap2.CreateCompatibleBitmap(pdc,rcBounds.right,rcBounds.bottom); CBitmap* pOldBitmap2; pOldBitmap2=offscreenDC2.SelectObject(&bitmap2); // first draw the background artwork CRect rect; GetWindowRect(rect); CRect parentrect; parent->GetWindowRect(parentrect); int offsetx; int offsety; offsetx=short(offsets & 0x0000FFFF)+parentrect.left-rect.left; offsety=short((offsets & 0xFFFF0000)>>16)+parentrect.top-rect.top; FileNum artwork; artwork=(FileNum)parent->SendMessage(WM_GETARTWORK,NULL,NULL); DrawBitmap(artwork,pOffScreenDC2,offsetx,offsety); */ // now overlay the semi-transparent scrollbar body // if (m_bHorzAlign) // MergeBitmap(FileNum(FIL_HORZSCROLLBAR,pOffScreenDC,0,0); // else // MergeBitmap(FileNum(FIL_VERTSCROLLBAR,pOffScreenDC,0,0); if (m_bHorzAlign) { DrawTiledBitmap(FileNum(FIL_HORZ_SCROLLBAR+m_FileNumOffset),pOffScreenDC,SBWIDTH,0,rcBounds.right-rcBounds.left-SBWIDTH-SBWIDTH); } else { DrawTiledBitmap(FileNum(FIL_VERT_SCROLLBAR+m_FileNumOffset),pOffScreenDC,0,SBWIDTH,rcBounds.bottom-rcBounds.top-SBWIDTH-SBWIDTH); } /* int x; if (m_bHorzAlign) { for (x=32;x<rcBounds.right-rcBounds.left-32;x+=128) DrawBitmap(FileNum(FIL_HORZ_SCROLLBAR,pOffScreenDC,x,0); } else { for (x=32;x<rcBounds.bottom-rcBounds.top-32;x+=128) DrawBitmap(FileNum(FIL_VERT_SCROLLBAR,pOffScreenDC,0,x); }*/ // MergeDCs(pOffScreenDC2,pOffScreenDC); /* // supported in Windoze 98 only // MergeDCs does the same thing however GetClientRect(rect); BLENDFUNCTION blendfunction; blendfunction.blendOp=AC_SRC_OVER; blendfunction.blendFlags=NULL; blendfunction.SourceConstantAlpha=127; blendfunction.AlphaFormat=NULL; AlphaBlend(pOffScreenDC->m_hDC,0,0,rect.right,rect.bottom, pdc->m_hDC,0,0,rect.right,rect.bottom,blendfunction); */ // now draw the puck if (m_bHorzAlign) { int divisor=m_pagesize+m_lMaxValue-m_lMinValue; int puckwidth=0; if (divisor>0) puckwidth=(m_pagesize*(rcBounds.right-rcBounds.left-SBWIDTH-SBWIDTH-PUCKEND-PUCKEND))/divisor; int puckpos=(m_iScrollPos*(rcBounds.right-rcBounds.left-SBWIDTH-SBWIDTH-PUCKEND-PUCKEND-puckwidth))/(m_lMaxValue-m_lMinValue); DrawTransparentBitmap(FileNum(FIL_PUCK_LEFT+m_FileNumOffset),pOffScreenDC,SBWIDTH+puckpos,PUCKGAP); DrawTransparentBitmap(FileNum(FIL_PUCK_RIGHT+m_FileNumOffset),pOffScreenDC,SBWIDTH+PUCKEND+puckpos+puckwidth,PUCKGAP); // for (int x=32+12+puckpos;x<32+12+puckpos+puckwidth;x++) // { // DrawBitmap(FileNum(FIL_PUCK_MIDDLE_HORZ,pOffScreenDC,x,PUCKGAP); // } DrawTiledBitmap(FileNum(FIL_PUCK_MIDDLE_HORZ+m_FileNumOffset),pOffScreenDC,SBWIDTH+PUCKEND+puckpos,PUCKGAP,puckwidth); } else { int divisor=m_pagesize+m_lMaxValue-m_lMinValue; int puckwidth=0; if (divisor>0) puckwidth=(m_pagesize*(rcBounds.bottom-rcBounds.top-SBWIDTH-SBWIDTH-PUCKEND-PUCKEND))/divisor; int puckpos=(m_iScrollPos*(rcBounds.bottom-rcBounds.top-SBWIDTH-SBWIDTH-PUCKEND-PUCKEND-puckwidth))/(m_lMaxValue-m_lMinValue); DrawTransparentBitmap(FileNum(FIL_PUCK_TOP+m_FileNumOffset),pOffScreenDC,PUCKGAP,SBWIDTH+puckpos); DrawTransparentBitmap(FileNum(FIL_PUCK_BOTTOM+m_FileNumOffset),pOffScreenDC,PUCKGAP,SBWIDTH+PUCKEND+puckpos+puckwidth); // for (int x=32+PUCKEND+puckpos;x<32+PUCKEND+puckpos+puckwidth;x++) // { // DrawBitmap(FileNum(FIL_PUCK_MIDDLE_VERT,pOffScreenDC,PUCKGAP,x); // } DrawTiledBitmap(FileNum(FIL_PUCK_MIDDLE_VERT+m_FileNumOffset),pOffScreenDC,PUCKGAP,SBWIDTH+PUCKEND+puckpos,puckwidth); } // now draw the buttons at the ends FileNum filenum; if (m_button==1) filenum=FileNum(FIL_SCROLLBAR_BUTTON_DOWN+m_FileNumOffset); else filenum=FileNum(FIL_SCROLLBAR_BUTTON_UP+m_FileNumOffset); DrawBitmap(filenum,pOffScreenDC,0,0); if (m_button==2) filenum=FileNum(FIL_SCROLLBAR_BUTTON_DOWN+m_FileNumOffset); else filenum=FileNum(FIL_SCROLLBAR_BUTTON_UP+m_FileNumOffset); if (m_bHorzAlign) DrawBitmap(filenum,pOffScreenDC,rcBounds.right-SBWIDTH,0); else DrawBitmap(filenum,pOffScreenDC,0,rcBounds.bottom-SBWIDTH); pdc->BitBlt(0,0,rcBounds.right-rcBounds.left,rcBounds.bottom-rcBounds.top,pOffScreenDC, 0,0,SRCCOPY); // flips offscreen dc to real dc pOffScreenDC->SelectObject(pOldBitmap); // then delete the dc // offscreenDC2.SelectObject(pOldBitmap2); // offscreenDC2.DeleteDC(); m_bDrawing=FALSE; }