[Deinterlace-checkins] CVS: DScaler/DScaler Providers.cpp,1.32,1.33 Providers.h,1.10,1.11 StillProvi
Brought to you by:
adcockj,
dschmelzer
From: Laurent G. <lau...@us...> - 2002-04-27 00:38:40
|
Update of /cvsroot/deinterlace/DScaler/DScaler In directory usw-pr-cvs1:/tmp/cvs-serv5568 Modified Files: Providers.cpp Providers.h StillProvider.cpp StillSource.cpp StillSource.h Log Message: New default source (still) used at DScaler startup or when there is no more source accessible Index: Providers.cpp =================================================================== RCS file: /cvsroot/deinterlace/DScaler/DScaler/Providers.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -r1.32 -r1.33 *** Providers.cpp 13 Apr 2002 21:52:40 -0000 1.32 --- Providers.cpp 27 Apr 2002 00:38:33 -0000 1.33 *************** *** 19,22 **** --- 19,25 ---- // // $Log$ + // Revision 1.33 2002/04/27 00:38:33 laurentg + // New default source (still) used at DScaler startup or when there is no more source accessible + // // Revision 1.32 2002/04/13 21:52:40 laurentg // Management of no current source *************** *** 156,160 **** #endif ! typedef vector<CSource*> SOURCELIST; extern HMENU hMenu; --- 159,169 ---- #endif ! typedef struct { ! std::string Name; ! CSource* Object; ! BOOL DisplayInMenu; ! } TSource; ! ! typedef vector<TSource*> SOURCELIST; extern HMENU hMenu; *************** *** 165,173 **** static CStillProvider* StillProvider = NULL; static long CurrentSource = 0; int Providers_Load(HMENU hMenu) { int i(0); ! char Text[265]; ModifyMenu(hMenu, 5, MF_BYPOSITION | MF_POPUP | MF_STRING, (UINT)CreatePopupMenu(), "&Sources"); --- 174,184 ---- static CStillProvider* StillProvider = NULL; static long CurrentSource = 0; + static long DefSourceIdx = -1; int Providers_Load(HMENU hMenu) { int i(0); ! TSource* Source; ! CSource* DefaultSource = NULL; ModifyMenu(hMenu, 5, MF_BYPOSITION | MF_POPUP | MF_STRING, (UINT)CreatePopupMenu(), "&Sources"); *************** *** 181,197 **** for(i = 0; i < BT848Provider->GetNumberOfSources(); ++i) { ! if(Sources.size() < 100) { ! if (BT848Provider->GetSource(i)->GetMenuLabel() == NULL) ! { ! sprintf(Text, "BT848 Card %d", i + 1); ! } ! else ! { ! strcpy(Text, BT848Provider->GetSource(i)->GetMenuLabel()); ! } ! AppendMenu(hSubMenu, MF_STRING | MF_ENABLED, IDM_SOURCE_FIRST + Sources.size(), Text); } ! Sources.push_back(BT848Provider->GetSource(i)); // Mute the audio of this source CurrentSource = i; --- 192,207 ---- for(i = 0; i < BT848Provider->GetNumberOfSources(); ++i) { ! Source = (TSource*) malloc(sizeof(TSource)); ! if (BT848Provider->GetSource(i)->GetMenuLabel() == NULL) { ! Source->Name = "BT848 Card"; ! } ! else ! { ! Source->Name = BT848Provider->GetSource(i)->GetMenuLabel(); } ! Source->Object = BT848Provider->GetSource(i); ! Source->DisplayInMenu = TRUE; ! Sources.push_back(Source); // Mute the audio of this source CurrentSource = i; *************** *** 208,224 **** for(i = 0; i < StillProvider->GetNumberOfSources(); ++i) { ! if(Sources.size() < 100) { ! if (StillProvider->GetSource(i)->GetMenuLabel() == NULL) ! { ! sprintf(Text, "Still %d", i + 1); ! } ! else ! { ! strcpy(Text, StillProvider->GetSource(i)->GetMenuLabel()); ! } ! AppendMenu(hSubMenu, MF_STRING | MF_ENABLED, IDM_SOURCE_FIRST + Sources.size(), Text); } ! Sources.push_back(StillProvider->GetSource(i)); } --- 218,233 ---- for(i = 0; i < StillProvider->GetNumberOfSources(); ++i) { ! Source = (TSource*) malloc(sizeof(TSource)); ! if (StillProvider->GetSource(i)->GetMenuLabel() == NULL) { ! Source->Name = "Still"; } ! else ! { ! Source->Name = StillProvider->GetSource(i)->GetMenuLabel(); ! } ! Source->Object = StillProvider->GetSource(i); ! Source->DisplayInMenu = TRUE; ! Sources.push_back(Source); } *************** *** 227,240 **** for(i = 0; i < DSProvider->GetNumberOfSources(); ++i) { ! if(Sources.size() < 100) { ! AppendMenu(hSubMenu, MF_STRING | MF_ENABLED, IDM_SOURCE_FIRST + Sources.size(),DSProvider->getSourceName(i).c_str()); } ! Sources.push_back(DSProvider->GetSource(i)); } - #endif ! // Switch to the first source which access is "allowed" ! Providers_FindSource(); Providers_UpdateMenu(hMenu); --- 236,286 ---- for(i = 0; i < DSProvider->GetNumberOfSources(); ++i) { ! Source = (TSource*) malloc(sizeof(TSource)); ! Source->Name = DSProvider->getSourceName(i).c_str(); ! Source->Object = DSProvider->GetSource(i); ! Source->DisplayInMenu = TRUE; ! Sources.push_back(Source); ! } ! #endif ! ! DefaultSource = Providers_GetIntroSource(); ! if (!DefaultSource || !DefaultSource->IsAccessAllowed()) ! { ! ErrorBox("Can't load file DScaler.d3u"); ! ! // We destroy the source if it exists ! DefSourceIdx = Providers_GetSourceIndex(DefaultSource); ! if (DefSourceIdx >= 0 && DefSourceIdx < Sources.size()) { ! Source = *(Sources.begin() + DefSourceIdx); ! Sources.erase(Sources.begin() + DefSourceIdx); ! free(Source); } ! ! DefaultSource = NULL; } ! DefSourceIdx = Providers_GetSourceIndex(DefaultSource); ! ! if (DefSourceIdx >= 0 && DefSourceIdx < Sources.size()) ! { ! // The default source is not listed in the menu ! Source = *(Sources.begin() + DefSourceIdx); ! Source->DisplayInMenu = FALSE; ! ! CurrentSource = DefSourceIdx; ! } ! else ! { ! CurrentSource = Providers_FindSource(); ! } ! ! for(i = 0; i < Sources.size() && i < 100 ; ++i) ! { ! if (Sources[i]->DisplayInMenu) ! { ! AppendMenu(hSubMenu, MF_STRING | MF_ENABLED, IDM_SOURCE_FIRST + i, Sources[i]->Name.c_str()); ! } ! } Providers_UpdateMenu(hMenu); *************** *** 268,271 **** --- 314,323 ---- HardwareDriver = NULL; } + for(vector<TSource*>::iterator it = Sources.begin(); + it != Sources.end(); + ++it) + { + free(*it); + } Sources.clear(); } *************** *** 275,279 **** if(CurrentSource >= 0 && CurrentSource < Sources.size()) { ! return Sources[CurrentSource]; } else --- 327,331 ---- if(CurrentSource >= 0 && CurrentSource < Sources.size()) { ! return Sources[CurrentSource]->Object; } else *************** *** 283,286 **** --- 335,350 ---- } + long Providers_GetSourceIndex(CSource* Src) + { + for (int i(0) ; i < Sources.size() ; i++) + { + if (Sources[i]->Object == Src) + { + return i; + } + } + return -1; + } + CSource* Providers_GetStillsSource() { *************** *** 298,315 **** } ! BOOL Providers_FindSource() { ! CurrentSource = 0; ! while ((CurrentSource < Sources.size()) && !Sources[CurrentSource]->IsAccessAllowed()) { ! CurrentSource++; } ! if(CurrentSource >= 0 && CurrentSource < Sources.size()) { ! return TRUE; } else { ! return FALSE; } } --- 362,384 ---- } ! CSource* Providers_GetIntroSource() { ! return StillProvider->GetSource(3); ! } ! ! int Providers_FindSource() ! { ! int SourceIdx = 0; ! while ((SourceIdx < Sources.size()) && !Sources[SourceIdx]->Object->IsAccessAllowed()) { ! SourceIdx++; } ! if(SourceIdx >= 0 && SourceIdx < Sources.size()) { ! return SourceIdx; } else { ! return -1; } } *************** *** 319,329 **** for(int i(0); i < Sources.size(); ++i) { ! CheckMenuItemBool(hMenu, IDM_SOURCE_FIRST + i, (CurrentSource == i)); ! EnableMenuItem(hMenu, IDM_SOURCE_FIRST + i, Sources[i]->IsAccessAllowed() ? MF_ENABLED : MF_GRAYED); } if(CurrentSource >= 0 && CurrentSource < Sources.size()) { ! Sources[CurrentSource]->SetMenu(hMenu); } } --- 388,401 ---- for(int i(0); i < Sources.size(); ++i) { ! if (Sources[i]->DisplayInMenu) ! { ! CheckMenuItemBool(hMenu, IDM_SOURCE_FIRST + i, (CurrentSource == i)); ! EnableMenuItem(hMenu, IDM_SOURCE_FIRST + i, Sources[i]->Object->IsAccessAllowed() ? MF_ENABLED : MF_GRAYED); ! } } if(CurrentSource >= 0 && CurrentSource < Sources.size()) { ! Sources[CurrentSource]->Object->SetMenu(hMenu); } } *************** *** 339,343 **** // get The name of our menu char Text[256]; ! HMENU hSubMenu = Sources[CurrentSource]->GetSourceMenu(); GetMenuString(hSubMenu, 0, Text, 256, MF_BYPOSITION); // Add the new menu --- 411,415 ---- // get The name of our menu char Text[256]; ! HMENU hSubMenu = Sources[CurrentSource]->Object->GetSourceMenu(); GetMenuString(hSubMenu, 0, Text, 256, MF_BYPOSITION); // Add the new menu *************** *** 345,349 **** // Update our menu ! Sources[CurrentSource]->UpdateMenu(); } else --- 417,421 ---- // Update our menu ! Sources[CurrentSource]->Object->UpdateMenu(); } else *************** *** 406,410 **** for(int i = 0; i < Sources.size(); ++i) { ! if(Sources[i]->OpenMediaFile(FilePath, FALSE)) { CurrentSource = i; --- 478,482 ---- for(int i = 0; i < Sources.size(); ++i) { ! if(Sources[i]->Object->OpenMediaFile(FilePath, FALSE)) { CurrentSource = i; *************** *** 422,426 **** { Stop_Capture(); ! Providers_FindSource(); Providers_UpdateMenu(hMenu); Start_Capture(); --- 494,505 ---- { Stop_Capture(); ! if (DefSourceIdx >= 0 && DefSourceIdx < Sources.size()) ! { ! CurrentSource = DefSourceIdx; ! } ! else ! { ! CurrentSource = Providers_FindSource(); ! } Providers_UpdateMenu(hMenu); Start_Capture(); *************** *** 429,433 **** if(CurrentSource >= 0 && CurrentSource < Sources.size()) { ! return Sources[CurrentSource]->HandleWindowsCommands(hWnd, wParam, lParam); } return FALSE; --- 508,512 ---- if(CurrentSource >= 0 && CurrentSource < Sources.size()) { ! return Sources[CurrentSource]->Object->HandleWindowsCommands(hWnd, wParam, lParam); } return FALSE; *************** *** 441,445 **** CSource* Providers_GetByIndex(long Index) { ! return Sources[Index]; } --- 520,524 ---- CSource* Providers_GetByIndex(long Index) { ! return Sources[Index]->Object; } *************** *** 449,453 **** if(CurrentSource >= 0 && CurrentSource < Sources.size()) { ! Sources[CurrentSource]->HandleTimerMessages(TimerId); } } --- 528,532 ---- if(CurrentSource >= 0 && CurrentSource < Sources.size()) { ! Sources[CurrentSource]->Object->HandleTimerMessages(TimerId); } } *************** *** 457,461 **** if(CurrentSource >= 0 && CurrentSource < Sources.size()) { ! Sources[CurrentSource]->ReadFromIni(); } } --- 536,540 ---- if(CurrentSource >= 0 && CurrentSource < Sources.size()) { ! Sources[CurrentSource]->Object->ReadFromIni(); } } *************** *** 465,469 **** if(CurrentSource >= 0 && CurrentSource < Sources.size()) { ! Sources[CurrentSource]->WriteToIni(bOptimizeFileAccess); } } --- 544,548 ---- if(CurrentSource >= 0 && CurrentSource < Sources.size()) { ! Sources[CurrentSource]->Object->WriteToIni(bOptimizeFileAccess); } } Index: Providers.h =================================================================== RCS file: /cvsroot/deinterlace/DScaler/DScaler/Providers.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** Providers.h 13 Apr 2002 21:52:40 -0000 1.10 --- Providers.h 27 Apr 2002 00:38:33 -0000 1.11 *************** *** 27,34 **** void Provider_HandleTimerMessages(int TimerId); CSource* Providers_GetCurrentSource(); CSource* Providers_GetStillsSource(); CSource* Providers_GetSnapshotsSource(); CSource* Providers_GetPatternsSource(); ! BOOL Providers_FindSource(); BOOL Providers_AddSource(CSource* pSource, HMENU hMenu); BOOL Providers_RemoveSource(CSource* pSource, HMENU hMenu); --- 27,36 ---- void Provider_HandleTimerMessages(int TimerId); CSource* Providers_GetCurrentSource(); + long Providers_GetSourceIndex(CSource* Src); CSource* Providers_GetStillsSource(); CSource* Providers_GetSnapshotsSource(); CSource* Providers_GetPatternsSource(); ! CSource* Providers_GetIntroSource(); ! int Providers_FindSource(); BOOL Providers_AddSource(CSource* pSource, HMENU hMenu); BOOL Providers_RemoveSource(CSource* pSource, HMENU hMenu); Index: StillProvider.cpp =================================================================== RCS file: /cvsroot/deinterlace/DScaler/DScaler/StillProvider.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** StillProvider.cpp 30 Mar 2002 13:18:31 -0000 1.14 --- StillProvider.cpp 27 Apr 2002 00:38:33 -0000 1.15 *************** *** 19,22 **** --- 19,25 ---- // // $Log$ + // Revision 1.15 2002/04/27 00:38:33 laurentg + // New default source (still) used at DScaler startup or when there is no more source accessible + // // Revision 1.14 2002/03/30 13:18:31 laurentg // New ini setting to choose the directory where to save snapshots *************** *** 94,97 **** --- 97,107 ---- pStillSource = new CStillSource("Snapshots"); m_StillSources.push_back(pStillSource); + + pStillSource = new CStillSource("DScaler intro"); + m_StillSources.push_back(pStillSource); + GetModuleFileName (NULL, PlayList, sizeof(PlayList)); + strcpy(strrchr(PlayList, '\\'), "\\DScaler.d3u"); + pStillSource->OpenMediaFile(PlayList, TRUE); + pStillSource->SetNavigOnly(TRUE); } Index: StillSource.cpp =================================================================== RCS file: /cvsroot/deinterlace/DScaler/DScaler/StillSource.cpp,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -r1.49 -r1.50 *** StillSource.cpp 15 Apr 2002 22:50:09 -0000 1.49 --- StillSource.cpp 27 Apr 2002 00:38:33 -0000 1.50 *************** *** 19,22 **** --- 19,25 ---- // // $Log$ + // Revision 1.50 2002/04/27 00:38:33 laurentg + // New default source (still) used at DScaler startup or when there is no more source accessible + // // Revision 1.49 2002/04/15 22:50:09 laurentg // Change again the available formats for still saving *************** *** 284,287 **** --- 287,291 ---- m_pMemcpy = NULL; m_SquarePixels = TRUE; + m_NavigOnly = FALSE; } *************** *** 697,700 **** --- 701,712 ---- return FALSE; + if (m_NavigOnly + && (LOWORD(wParam) == IDM_PLAYLIST_UP + || LOWORD(wParam) == IDM_PLAYLIST_DOWN + || LOWORD(wParam) == IDM_CLOSE_FILE + || LOWORD(wParam) == IDM_CLOSE_ALL + || LOWORD(wParam) == IDM_PLAYLIST_SAVE)) + return FALSE; + if ( (LOWORD(wParam) >= IDM_PLAYLIST_FILES) && (LOWORD(wParam) < (IDM_PLAYLIST_FILES+MAX_PLAYLIST_SIZE)) ) { *************** *** 1118,1122 **** EnableMenuItem(hMenu, IDM_PLAYLIST_PREVIOUS, MF_ENABLED); EnableMenuItem(hMenu, IDM_PLAYLIST_FIRST, MF_ENABLED); ! EnableMenuItem(hMenu, IDM_PLAYLIST_UP, MF_ENABLED); } else --- 1130,1134 ---- EnableMenuItem(hMenu, IDM_PLAYLIST_PREVIOUS, MF_ENABLED); EnableMenuItem(hMenu, IDM_PLAYLIST_FIRST, MF_ENABLED); ! EnableMenuItem(hMenu, IDM_PLAYLIST_UP, m_NavigOnly ? MF_GRAYED : MF_ENABLED); } else *************** *** 1130,1134 **** EnableMenuItem(hMenu, IDM_PLAYLIST_NEXT, MF_ENABLED); EnableMenuItem(hMenu, IDM_PLAYLIST_LAST, MF_ENABLED); ! EnableMenuItem(hMenu, IDM_PLAYLIST_DOWN, MF_ENABLED); } else --- 1142,1146 ---- EnableMenuItem(hMenu, IDM_PLAYLIST_NEXT, MF_ENABLED); EnableMenuItem(hMenu, IDM_PLAYLIST_LAST, MF_ENABLED); ! EnableMenuItem(hMenu, IDM_PLAYLIST_DOWN, m_NavigOnly ? MF_GRAYED : MF_ENABLED); } else *************** *** 1151,1154 **** --- 1163,1170 ---- } + EnableMenuItem(hMenu, IDM_CLOSE_FILE, m_NavigOnly ? MF_GRAYED : MF_ENABLED); + EnableMenuItem(hMenu, IDM_CLOSE_ALL, m_NavigOnly ? MF_GRAYED : MF_ENABLED); + EnableMenuItem(hMenu, IDM_PLAYLIST_SAVE, m_NavigOnly ? MF_GRAYED : MF_ENABLED); + hSubMenu = GetSubMenu(m_hMenu, 0); if(hSubMenu == NULL) return; *************** *** 1208,1211 **** --- 1224,1237 ---- return FALSE; + } + + void CStillSource::SetNavigOnly(BOOL NavigOnly) + { + m_NavigOnly = NavigOnly; + } + + BOOL CStillSource::IsNavigOnly() + { + return m_NavigOnly; } Index: StillSource.h =================================================================== RCS file: /cvsroot/deinterlace/DScaler/DScaler/StillSource.h,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -r1.27 -r1.28 *** StillSource.h 15 Apr 2002 22:50:09 -0000 1.27 --- StillSource.h 27 Apr 2002 00:38:33 -0000 1.28 *************** *** 122,125 **** --- 122,127 ---- void SetOverscan(); BOOL HasSquarePixels() {return m_SquarePixels;}; + void SetNavigOnly(BOOL NavigOnly); + BOOL IsNavigOnly(); friend class CTiffHelper; *************** *** 143,146 **** --- 145,149 ---- BOOL m_IsPictureRead; BOOL m_SquarePixels; + BOOL m_NavigOnly; private: |