Source Code (Use browser search to find items of interest.)

Class Index

khexedit'SDisplayLayout (./kdeutils/khexedit/hexeditstate.h:78)

struct SDisplayLayout
{
  enum EViewMode
  {
    hexadecimal = 0,
    decimal,
    octal,
    binary,
    textOnly,
    //decimal,
    hide
  };

  SDisplayLayout( void )
  {
    offsetMode       = hexadecimal;
    primaryMode      = hexadecimal;
    secondaryMode    = textOnly;
    offsetUpperCase  = false;
    primaryUpperCase = false;
    offsetVisible    = true;
    lineSize         = 16;
    columnSize       = 1;
    lockLine         = true;
    lockColumn       = true;
    columnCharSpace  = true;
    columnSpacing    = 5;
    separatorMarginWidth = 5;
    edgeMarginWidth      = 5;
    leftSeparatorWidth   = 1;
    rightSeparatorWidth  = 1;
    horzGridWidth    = 0;
    vertGridWidth    = 0;
  }

  void verify( void )
  {
    if( lineSize < 1 ) { lineSize  = 1; }
    if( columnSize < 1 ) { columnSize = 1; }
    if( columnSize > lineSize ) { columnSize = lineSize; }
    if( primaryMode == textOnly ) { secondaryMode = hide; columnSpacing = 0; }
    if( columnSpacing == 0 ) { columnSize = lineSize; }
    if( horzGridWidth > 1 ) { horzGridWidth = 1; }
    if( vertGridWidth > 1 ) { vertGridWidth = 1; }
  }

  bool showSecondary( void )
  {
    if( primaryMode == textOnly || secondaryMode == hide )
    {
      return( false );
    }
    else
    {
      return( true );
    }
  }
  
  const char *modeStrings( uint index )
  {
    static const char *str[6] = 
    {
      "hexadecimal",
      "decimal",
      "octal",
      "binary",
      "textOnly",
      //"decimal",
      "hide"
    };
    return( str[index] );
  }


  const char *primaryModeString( void )
  {
    return( modeStrings( primaryMode > textOnly ? hexadecimal : primaryMode ));
  }

  const char *secondaryModeString( void )
  {
    return( modeStrings( secondaryMode == textOnly ? textOnly : hide ) );
  }

  const char *offsetModeString( void )
  {
    return( modeStrings( offsetMode == hexadecimal ? hexadecimal : hide ) );
  }

  const char *gridModeString( void )
  {
    if( horzGridWidth == 0 && vertGridWidth == 0 )
    {
      return( "none");
    }
    else if( horzGridWidth != 0 && vertGridWidth != 0 )
    {
      return( "both");
    }
    else if( horzGridWidth != 0 )
    {
      return( "horizontal");
    }
    else
    {
      return( "vertical");
    }
  }

  void setPrimaryMode( const char *str )
  {
    if( str == 0 || strcmp( str, "hexadecimal" ) == 0 )
    {
      primaryMode = hexadecimal;
    }
    else if( strcmp( str, "decimal" ) == 0 )
    {
      primaryMode = decimal;
    }
    else if( strcmp( str, "octal" ) == 0 )
    {
      primaryMode = octal;
    }
    else if( strcmp( str, "binary" ) == 0 )
    {
      primaryMode = binary;
    }
    else if( strcmp( str, "textOnly" ) == 0 )
    {
      primaryMode = textOnly;
    }
    else
    {
      primaryMode = hexadecimal;
    }
  }

  void setSecondaryMode( const char *str )
  {
    if( str == 0 || strcmp( str, "textOnly" ) == 0 )
    {
      secondaryMode = textOnly;
    }
    else
    {
      secondaryMode = hide;
    }
  }

  void setOffsetMode( const char *str )
  {
    if( str == 0 || strcmp( str, "hexadecimal" ) == 0 )
    {
      offsetMode = hexadecimal;
    }
    else
    {
      offsetMode = decimal;
    }
  }

  void setGridMode( const char *str )
  {
    if( str == 0 || strcmp( str, "none" ) == 0 )
    {
      horzGridWidth = vertGridWidth = 0;
    }
    else if( strcmp( str, "vertical" ) == 0 )
    {
      horzGridWidth = 0;
      vertGridWidth = 1;
    }
    else if( strcmp( str, "horizontal" ) == 0 )
    {
      horzGridWidth = 1;
      vertGridWidth = 0;
    }
    else if( strcmp( str, "both" ) == 0 )
    {
      horzGridWidth = vertGridWidth = 1;
    }
    else
    {
      horzGridWidth = vertGridWidth = 0;
    }
  }





  EViewMode offsetMode;
  EViewMode primaryMode;
  EViewMode secondaryMode;
  bool offsetUpperCase;
  bool primaryUpperCase;
  bool offsetVisible;
  bool lockLine;
  bool lockColumn;
  uint lineSize;
  uint columnSize;
  bool columnCharSpace;
  uint columnSpacing;
  uint separatorMarginWidth;
  uint edgeMarginWidth;
  uint leftSeparatorWidth;
  uint rightSeparatorWidth;
  uint horzGridWidth;
  uint vertGridWidth;
};