osdmenu.lst

来自「显示屏驱动源代码」· LST 代码 · 共 1,286 行 · 第 1/5 页

LST
1,286
字号
             - ); 
 241   1      
 242   1              // Display ColorSystem
 243   1              #if defined( SUPPORT_PC ) || defined( SUPPORT_DTV )
 244   1              i = GetInputSelection();
 245   1              if( i==PC || i==DTV ){
 246   2                      len=strlen(GetPCInputSourceName());
 247   2                      WriteStringToAddr(OSDMENU_SUBADDR+MENU_WIDTH*(1+title)+OSD_INFO_SUB_X, GetPCInputSourceName(), len ); 
 248   2              }
 249   1              else
 250   1              #endif
 251   1              {
 252   2                      len=strlen(struct_VInputStd[GetVInputStdInx()].Name);
 253   2                      WriteStringToAddr(OSDMENU_SUBADDR+MENU_WIDTH*(1+title)+OSD_INFO_SUB_X, struct_VInputStd[GetVInputStdInx(
             -)].Name, len ); 
 254   2              }
 255   1      
 256   1              #if defined( SUPPORT_PC ) || defined( SUPPORT_DTV )
 257   1              //IHF
 258   1              MeasureAndWait(3);
 259   1              #endif
 260   1      
 261   1              ltoa_K(IHF, mstr, 1);
 262   1              len=strlen(mstr);
 263   1              WriteStringToAddr(OSDMENU_SUBADDR+MENU_WIDTH*(2+title)+OSD_INFO_SUB_X, mstr, len ); 
 264   1      
 265   1              utoa(IVF,mstr,10);
 266   1              len=strlen(mstr);
 267   1              WriteStringToAddr(OSDMENU_SUBADDR+MENU_WIDTH*(3+title)+OSD_INFO_SUB_X, mstr, len ); 
 268   1      
 269   1              //FWRev
 270   1              i = ReadEEP(EEP_FWREV_MAJOR);
 271   1              mstr[0] = i + '0';
 272   1              mstr[1] = '.';
 273   1              i = ReadEEP(EEP_FWREV_MINOR);
 274   1              mstr[2] = (i/0x10) + '0';
 275   1              mstr[3] = (i%0x10) + '0';
 276   1              mstr[4] = '\0';
 277   1              
 278   1              WriteStringToAddr(OSDMENU_SUBADDR+MENU_WIDTH*(4+title)+OSD_INFO_SUB_X, mstr, 4 ); 
 279   1      
 280   1      }
 281          
 282          
 283          //********************************************************************
 284          //
 285          //      Functions for BAR.
 286          //
 287          //********************************************************************
 288          #define VOLBAR_LENGTH 21+3
 289          void DisplayVolumebar(BYTE val)
 290          {
 291   1              CODE BYTE BAR_ROM_TABLE[] = {
 292   1                      0x01, // ...
 293   1                      0x02,0x02, // |..
 294   1                      0x05,0x05, // ||.
 295   1                      0x03, // |
 296   1                      0x04, // |||
 297   1              };
 298   1      
 299   1              BYTE i;
 300   1              BYTE Bar_str[VOLBAR_LENGTH]={ 0x04, 0x04, 0x04, 0x04, 0x04,
C51 COMPILER V7.06   OSDMENU                                                               02/21/2008 14:00:28 PAGE 6   

 301   1                                                                 0x04, 0x04, 0x04, 0x04, 0x04,
 302   1                                                                 0x04, 0x04, 0x04, 0x04, 0x04,
 303   1                                                                 0x04, 0x04, 0x04, 0x04, 0x04, 0x03,' ',' ',' ' };
 304   1              WORD addr;
 305   1              
 306   1              if(val < 100)
 307   1              {
 308   2                      Bar_str[val/5] = BAR_ROM_TABLE[val%5];
 309   2                      for(i = val/5 + 1; i < 20; i++)
 310   2                              Bar_str[i] = BAR_ROM_TABLE[0];
 311   2              }
 312   1      
 313   1              if( Bar_str[0] == 0x01 ) Bar_str[0] = 0x02;     // |..
 314   1      
 315   1              // Number
 316   1          Bar_str[23] = val % 10 + '0';    val /= 10;
 317   1          Bar_str[22] =  val % 10 + '0';    val /= 10;
 318   1          Bar_str[21] = val + '0';
 319   1              if( Bar_str[21] == '0' ) Bar_str[21] = ' ';
 320   1      
 321   1              addr = OSDMENU_BARADDR + 1 + VOLBAR_LENGTH;     // 
 322   1      
 323   1              WriteStringToAddr(addr, Bar_str, VOLBAR_LENGTH ); 
 324   1      
 325   1      }
 326          
 327          BYTE Get_cursor_item(BYTE id)
 328          {
 329   1              BYTE i=NIL, tid;
 330   1      
 331   1              #ifdef DEBUG_OSD
                      dPrintf("\r\n++(Get_cursor_item) id:%d", (WORD)id);
                      #endif
 334   1      
 335   1              
 336   1              switch ( id ) {
 337   2              case INPUTSELECTION:    tid = GetInputSelection(); 
 338   2                                                              break;
 339   2      
 340   2              default:                                return 0;// The first one
 341   2              }
 342   1      
 343   1              i = GetTargetChild( tid );
 344   1      
 345   1              if( i==NIL ) {  //couldn't find
 346   2                      dPuts("___Couldn't find cursor!!");
 347   2                      i=0;
 348   2              }
 349   1      
 350   1              #ifdef DEBUG_OSD
                      dPrintf("___Cursor:%d\r\n__(GetDefaultForChoiceMenu)", (WORD)i);
                      #endif
 353   1      
 354   1              return i;
 355   1      }
 356          
 357          //==================================================================================================
 358          // Func: DisplayOSDMenuOneItem
 359          //
 360          //
 361          void DisplayOSDMenuOneItem( winno, CODE_P struct DefineMenu *DMp, BYTE x, BYTE y, BYTE NOTViewflag )
 362          {
C51 COMPILER V7.06   OSDMENU                                                               02/21/2008 14:00:28 PAGE 7   

 363   1              BYTE i,j,k,IconColor;
 364   1              WORD addr;
 365   1              CODE_P BYTE *Str;
 366   1              CODE BYTE RightSign_str[]=      { 0x1c,' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',0 };// RIGHT mark
 367   1      
 368   1              #ifdef DEBUG_OSD
                      dPrintf("\r\n++(DisplayOSDMenuOneItem) ");
                      #endif
 371   1      
 372   1              if( cur_osdwin == OSDMENU_TOPWIN) addr = OSDMENU_MAINADDR;
 373   1              else addr = OSDMENU_SUBADDR;
 374   1      
 375   1              addr = addr + x + y*MenuFormat->width;
 376   1      
 377   1              #ifdef DEBUG_OSD
                      dPrintf("\r\nStartaddr:%d", addr);
                      #endif
 380   1      
 381   1              if( DMp->IconColor !=NIL ) {            // Draw Icon
 382   2                      //if(OnChangingValue) IconColor = BG_COLOR_BLACK|CH_COLOR_WHITE|EXTENDED_COLOR; 
 383   2                      //else
 384   2                              IconColor =  DMp->IconColor;
 385   2      
 386   2                      Str = DMp->Icon;
 387   2                      j=strlen(Str);
 388   2                      WriteStringToAddr(addr, Str, j);
 389   2      
 390   2                      x += ICON_CH_SZ;
 391   2              }
 392   1      
 393   1              if( DMp->DescColor !=NIL ) {            // Draw Desc.
 394   2      
 395   2                      Str = DMp->Desc[OSDLang];
 396   2                      j=strlen(Str);
 397   2      
 398   2                      for( i=0,k=0; i<j; i++ )
 399   2                              if( *(Str+i) == ROMFONT || *(Str+i) == RAMFONT ) k++;
 400   2      
 401   2                      #ifdef DEBUG_OSD
                              dPrintf("\r\naddr:%d x:%d y:%d MenuFormat->width:%d", addr, (WORD)x, (WORD)y, (WORD)MenuFormat->width );
                              #endif
 404   2      
 405   2                      WriteStringToAddr(addr, Str, j);
 406   2      
 407   2                      if( (j-k ) < MAX_DESC ) 
 408   2                              ClearDataCnt(addr+j-k, MAX_DESC-j+k);
 409   2              
 410   2                      addr+=MAX_DESC;
 411   2      
 412   2              }
 413   1      
 414   1              if( OSDMenuLevel < 3) // Main Menu Item.
 415   1               if ( NOTViewflag==1 )  return; // In case of not need diplay contents. ex, BAR windows, top menu display.
 416   1              
 417   1              // Menu contents view
 418   1              /*if( x < (MenuFormat->width) )
 419   1                      if( x <  (MAX_DESC + ICON_CH_SZ) ){
 420   1                      //x+=2;
 421   1                      ClearDataCnt(addr, 2);
 422   1                      addr+=2;
 423   1              }*/
 424   1      
C51 COMPILER V7.06   OSDMENU                                                               02/21/2008 14:00:28 PAGE 8   

 425   1              switch (DMp->Type ) {
 426   2              case BAR:       // Draw Bar and Number value
 427   2                      DisplayViewBar( addr, GetItemValue(DMp->Id));
 428   2                      break;
 429   2      
 430   2              case NUMBER: // Draw Number value
 431   2                      {
 432   3                              CODE_P BYTE *ptr;
 433   3                              ptr = DMp->TypeData;
 434   3                              switch ( DMp->Id ) {
 435   4                              #if defined( PAL_TV )
                                      case MANUAL_TUNE_CHANNEL:
                                              WriteStringToAddr(addr, RightSign_str, BARNUM_LENGTH); 
                                              break;
                                      #endif
 440   4                              default:
 441   4                                      DrawNum( addr, (CODE_P struct NumType *)ptr, GetItemValue(DMp->Id) );
 442   4                                      break;
 443   4                              }
 444   3                      }
 445   2                      break;
 446   2              case ENUM_STRING:               
 447   2                      {
 448   3                              CODE_P BYTE *ptr;
 449   3      
 450   3                              ptr = DMp->TypeData;
 451   3                              DrawStringByLang( addr, (CODE_P struct EnumType *)ptr, GetItemValue(DMp->Id) );
 452   3      
 453   3                      }
 454   2                      break;
 455   2      
 456   2              case NUMBER_STRING:
 457   2              case CHOICEMENU:
 458   2              case OSDMENU:
 459   2              case ACTION:
 460   2                              WriteStringToAddr(addr, RightSign_str, BARNUM_LENGTH); 
 461   2                              break;
 462   2      
 463   2              }
 464   1        
 465   1      }
 466          
 467          void ClearCursor(void)
 468          {
 469   1              //BYTE cursor_x;
 470   1              BYTE cursor_y;
 471   1              WORD addr;
 472   1      
 473   1              if( cursor_item==NIL )
 474   1                      return;
 475   1      
 476   1              //cursor_x = MenuFormat->CursorStart;
 477   1              cursor_y = cursor_item + ( MenuFormat->TitleColor ==NIL ? 0 : 1 );
 478   1              if( cur_osdwin == 4 ) addr = 0;
 479   1              else addr = 10;
 480   1              addr += cursor_y*MenuFormat->width;
 481   1              DrawAttrCnt(addr, DEFAULT_COLOR, MenuFormat->width );   
 482   1      
 483   1      }
 484          
 485          void DisplayCursor(void)
 486          {
C51 COMPILER V7.06   OSDMENU                                                               02/21/2008 14:00:28 PAGE 9   

 487   1              BYTE cursor_y=0 ;
 488   1              WORD addr;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?