예제 #1
0
void CPWL_IconList_Item::DrawThisAppearance(CFX_RenderDevice* pDevice,
                                            CFX_Matrix* pUser2Device) {
  CPDF_Rect rcClient = GetClientRect();

  if (m_bSelected) {
    if (IsEnabled()) {
      CPWL_Utils::DrawFillRect(
          pDevice, pUser2Device, rcClient,
          CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_SELBACKCOLOR,
                                        GetTransparency()));
    } else {
      CPWL_Utils::DrawFillRect(
          pDevice, pUser2Device, rcClient,
          CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_LIGHTGRAYCOLOR,
                                        GetTransparency()));
    }
  }

  CPDF_Rect rcIcon = rcClient;
  rcIcon.left += PWL_IconList_ITEM_ICON_LEFTMARGIN;
  rcIcon.right = rcIcon.left + PWL_IconList_ITEM_WIDTH;

  CPWL_Utils::DrawIconAppStream(pDevice, pUser2Device, m_nIconIndex, rcIcon,
                                m_crIcon, m_pText->GetTextColor(),
                                GetTransparency());
}
예제 #2
0
void CPWL_Note_Options::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device)
{
	CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device);

	CPDF_Rect rcClient = GetClientRect();
	rcClient.left = rcClient.right - 15.0f;

	CPDF_Point ptCenter = CPDF_Point((rcClient.left + rcClient.right) * 0.5f, (rcClient.top + rcClient.bottom) * 0.5f);

	CPDF_Point pt1(ptCenter.x - 2.0f, ptCenter.y + 2.0f * 0.5f);
	CPDF_Point pt2(ptCenter.x + 2.0f, ptCenter.y + 2.0f * 0.5f);
	CPDF_Point pt3(ptCenter.x, ptCenter.y - 3.0f * 0.5f);

	CFX_PathData path;

	path.SetPointCount(4);
	path.SetPoint(0, pt1.x, pt1.y, FXPT_MOVETO);
	path.SetPoint(1, pt2.x, pt2.y, FXPT_LINETO);
	path.SetPoint(2, pt3.x, pt3.y, FXPT_LINETO);
	path.SetPoint(3, pt1.x, pt1.y, FXPT_LINETO);

	pDevice->DrawPath(&path, pUser2Device, NULL, 
		CPWL_Utils::PWLColorToFXColor(GetTextColor(),GetTransparency()), 
		0, FXFILL_ALTERNATE);
}
예제 #3
0
void CPWL_CBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
                                       CPDF_Matrix* pUser2Device) {
  CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device);

  CPDF_Rect rectWnd = CPWL_Wnd::GetWindowRect();

  if (IsVisible() && !rectWnd.IsEmpty()) {
    CPDF_Point ptCenter = GetCenterPoint();

    CPDF_Point pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN,
                   ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f);
    CPDF_Point pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN,
                   ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f);
    CPDF_Point pt3(ptCenter.x,
                   ptCenter.y - PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f);

    if (IsFloatBigger(rectWnd.right - rectWnd.left,
                      PWL_CBBUTTON_TRIANGLE_HALFLEN * 2) &&
        IsFloatBigger(rectWnd.top - rectWnd.bottom,
                      PWL_CBBUTTON_TRIANGLE_HALFLEN)) {
      CFX_PathData path;

      path.SetPointCount(4);
      path.SetPoint(0, pt1.x, pt1.y, FXPT_MOVETO);
      path.SetPoint(1, pt2.x, pt2.y, FXPT_LINETO);
      path.SetPoint(2, pt3.x, pt3.y, FXPT_LINETO);
      path.SetPoint(3, pt1.x, pt1.y, FXPT_LINETO);

      pDevice->DrawPath(&path, pUser2Device, NULL,
                        CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_BLACKCOLOR,
                                                      GetTransparency()),
                        0, FXFILL_ALTERNATE);
    }
  }
}
예제 #4
0
void CPWL_CBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
                                       CFX_Matrix* pUser2Device) {
  CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device);

  CFX_FloatRect rectWnd = CPWL_Wnd::GetWindowRect();

  if (IsVisible() && !rectWnd.IsEmpty()) {
    CFX_PointF ptCenter = GetCenterPoint();

    CFX_PointF pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN,
                   ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f);
    CFX_PointF pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN,
                   ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f);
    CFX_PointF pt3(ptCenter.x,
                   ptCenter.y - PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f);

    if (IsFloatBigger(rectWnd.right - rectWnd.left,
                      PWL_CBBUTTON_TRIANGLE_HALFLEN * 2) &&
        IsFloatBigger(rectWnd.top - rectWnd.bottom,
                      PWL_CBBUTTON_TRIANGLE_HALFLEN)) {
      CFX_PathData path;
      path.AppendPoint(pt1, FXPT_TYPE::MoveTo, false);
      path.AppendPoint(pt2, FXPT_TYPE::LineTo, false);
      path.AppendPoint(pt3, FXPT_TYPE::LineTo, false);
      path.AppendPoint(pt1, FXPT_TYPE::LineTo, false);

      pDevice->DrawPath(&path, pUser2Device, nullptr,
                        PWL_DEFAULT_BLACKCOLOR.ToFXColor(GetTransparency()), 0,
                        FXFILL_ALTERNATE);
    }
  }
}
예제 #5
0
void CPWL_Edit::GeneratePageObjects(CPDF_PageObjects* pPageObjects,
                                    const CPDF_Point& ptOffset) {
  CFX_ArrayTemplate<CPDF_TextObject*> ObjArray;
  IFX_Edit::GeneratePageObjects(
      pPageObjects, m_pEdit, ptOffset, NULL,
      CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()),
      ObjArray);
}
예제 #6
0
void CPWL_Wnd::DrawThisAppearance(CFX_RenderDevice* pDevice,
                                  CFX_Matrix* pUser2Device) {
  CFX_FloatRect rectWnd = GetWindowRect();
  if (!rectWnd.IsEmpty()) {
    if (HasFlag(PWS_BACKGROUND)) {
      CFX_FloatRect rcClient = CPWL_Utils::DeflateRect(
          rectWnd, (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth()));
      CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcClient,
                               GetBackgroundColor(), GetTransparency());
    }

    if (HasFlag(PWS_BORDER))
      CPWL_Utils::DrawBorder(pDevice, pUser2Device, rectWnd,
                             (FX_FLOAT)GetBorderWidth(), GetBorderColor(),
                             GetBorderLeftTopColor(GetBorderStyle()),
                             GetBorderRightBottomColor(GetBorderStyle()),
                             GetBorderStyle(), GetTransparency());
  }
}
예제 #7
0
void CPWL_Label::DrawThisAppearance(CFX_RenderDevice* pDevice,
                                    CFX_Matrix* pUser2Device) {
  CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device);

  GetClientRect();

  CFX_FloatRect rcClip;
  CPVT_WordRange wrRange = m_pEdit->GetVisibleWordRange();
  CPVT_WordRange* pRange = NULL;

  if (!HasFlag(PES_TEXTOVERFLOW)) {
    rcClip = GetClientRect();
    pRange = &wrRange;
  }
  IFX_SystemHandler* pSysHandler = GetSystemHandler();
  IFX_Edit::DrawEdit(
      pDevice, pUser2Device, m_pEdit,
      CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()),
      CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor(), GetTransparency()),
      rcClip, CFX_FloatPoint(0.0f, 0.0f), pRange, pSysHandler, NULL);
}
예제 #8
0
void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice,
                                   CFX_Matrix* pUser2Device) {
  CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device);

  CPDF_Rect rcClient = GetClientRect();
  CFX_ByteTextBuf sLine;

  int32_t nCharArray = m_pEdit->GetCharArray();
  FX_SAFE_INT32 nCharArraySafe = nCharArray;
  nCharArraySafe -= 1;
  nCharArraySafe *= 2;

  if (nCharArray > 0 && nCharArraySafe.IsValid()) {
    switch (GetBorderStyle()) {
      case PBS_SOLID: {
        CFX_GraphStateData gsd;
        gsd.m_LineWidth = (FX_FLOAT)GetBorderWidth();

        CFX_PathData path;
        path.SetPointCount(nCharArraySafe.ValueOrDie());

        for (int32_t i = 0; i < nCharArray - 1; i++) {
          path.SetPoint(
              i * 2,
              rcClient.left +
                  ((rcClient.right - rcClient.left) / nCharArray) * (i + 1),
              rcClient.bottom, FXPT_MOVETO);
          path.SetPoint(
              i * 2 + 1,
              rcClient.left +
                  ((rcClient.right - rcClient.left) / nCharArray) * (i + 1),
              rcClient.top, FXPT_LINETO);
        }
        if (path.GetPointCount() > 0)
          pDevice->DrawPath(
              &path, pUser2Device, &gsd, 0,
              CPWL_Utils::PWLColorToFXColor(GetBorderColor(), 255),
              FXFILL_ALTERNATE);
      } break;
      case PBS_DASH: {
        CFX_GraphStateData gsd;
        gsd.m_LineWidth = (FX_FLOAT)GetBorderWidth();

        gsd.SetDashCount(2);
        gsd.m_DashArray[0] = (FX_FLOAT)GetBorderDash().nDash;
        gsd.m_DashArray[1] = (FX_FLOAT)GetBorderDash().nGap;
        gsd.m_DashPhase = (FX_FLOAT)GetBorderDash().nPhase;

        CFX_PathData path;
        path.SetPointCount(nCharArraySafe.ValueOrDie());

        for (int32_t i = 0; i < nCharArray - 1; i++) {
          path.SetPoint(
              i * 2,
              rcClient.left +
                  ((rcClient.right - rcClient.left) / nCharArray) * (i + 1),
              rcClient.bottom, FXPT_MOVETO);
          path.SetPoint(
              i * 2 + 1,
              rcClient.left +
                  ((rcClient.right - rcClient.left) / nCharArray) * (i + 1),
              rcClient.top, FXPT_LINETO);
        }
        if (path.GetPointCount() > 0)
          pDevice->DrawPath(
              &path, pUser2Device, &gsd, 0,
              CPWL_Utils::PWLColorToFXColor(GetBorderColor(), 255),
              FXFILL_ALTERNATE);
      } break;
    }
  }

  CPDF_Rect rcClip;
  CPVT_WordRange wrRange = m_pEdit->GetVisibleWordRange();
  CPVT_WordRange* pRange = NULL;

  if (!HasFlag(PES_TEXTOVERFLOW)) {
    rcClip = GetClientRect();
    pRange = &wrRange;
  }
  IFX_SystemHandler* pSysHandler = GetSystemHandler();
  IFX_Edit::DrawEdit(
      pDevice, pUser2Device, m_pEdit,
      CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()),
      CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor(), GetTransparency()),
      rcClip, CPDF_Point(0.0f, 0.0f), pRange, pSysHandler, m_pFormFiller);

  if (HasFlag(PES_SPELLCHECK)) {
    CPWL_Utils::DrawEditSpellCheck(pDevice, pUser2Device, m_pEdit, rcClip,
                                   CPDF_Point(0.0f, 0.0f), pRange,
                                   GetCreationParam().pSpellCheck);
  }
}
예제 #9
0
// Save():
const char * IllumiSurf_Instance::Save( const LWSaveState *saver ) {
  char cvalue;

  // Version
  LWSAVE_BEGIN( saver, &illumisurf_io_isfv[0], 0 );
  cvalue = 1;
  LWSAVE_I1( saver, &cvalue, 1 );

  // Blending Mode
  LWSAVE_BEGIN( saver, &illumisurf_io_root[ ISIOID_BLND ], 1 );
  cvalue = GetBlendMode();
  LWSAVE_I1( saver, &cvalue, 1 );
  LWSAVE_END( saver );

  // Base Intensity
  LWSAVE_BEGIN( saver, &illumisurf_io_root[ ISIOID_BINT ], 1 );
  vparam_funcs->save( GetBaseIntensity(), saver );
  LWSAVE_END( saver );

  // Alternate Intensity
  LWSAVE_BEGIN( saver, &illumisurf_io_root[ ISIOID_AINT ], 1 );
  vparam_funcs->save( GetAltIntensity(), saver );
  LWSAVE_END( saver );

  // Color
  LWSAVE_BEGIN( saver, &illumisurf_io_root[ ISIOID_COLR ], 1 );
  cvalue = GetUseColor() ? 1 : 0;
  LWSAVE_I1( saver, &cvalue, 1 );
  vparam_funcs->save( GetColor(), saver );
  LWSAVE_END( saver );

  // Luminosity
  LWSAVE_BEGIN( saver, &illumisurf_io_root[ ISIOID_LUMI ], 1 );
  cvalue = GetUseLuminosity() ? 1 : 0;
  LWSAVE_I1( saver, &cvalue, 1 );
  vparam_funcs->save( GetLuminosity(), saver );
  LWSAVE_END( saver );

  // Diffusion
  LWSAVE_BEGIN( saver, &illumisurf_io_root[ ISIOID_DIFF ], 1 );
  cvalue = GetUseDiffusion() ? 1 : 0;
  LWSAVE_I1( saver, &cvalue, 1 );
  vparam_funcs->save( GetDiffusion(), saver );
  LWSAVE_END( saver );

  // Specular
  LWSAVE_BEGIN( saver, &illumisurf_io_root[ ISIOID_SPEC ], 1 );
  cvalue = GetUseSpecular() ? 1 : 0;
  LWSAVE_I1( saver, &cvalue, 1 );
  vparam_funcs->save( GetSpecular(), saver );
  LWSAVE_END( saver );

  // Glossiness
  LWSAVE_BEGIN( saver, &illumisurf_io_root[ ISIOID_GLOS ], 1 );
  cvalue = GetUseGlossiness() ? 1 : 0;
  LWSAVE_I1( saver, &cvalue, 1 );
  vparam_funcs->save( GetGlossiness(), saver );
  LWSAVE_END( saver );

  // Reflection
  LWSAVE_BEGIN( saver, &illumisurf_io_root[ ISIOID_REFL ], 1 );
  cvalue = GetUseReflection() ? 1 : 0;
  LWSAVE_I1( saver, &cvalue, 1 );
  vparam_funcs->save( GetReflection(), saver );
  LWSAVE_END( saver );

  // Transparency
  LWSAVE_BEGIN( saver, &illumisurf_io_root[ ISIOID_TRNP ], 1 );
  cvalue = GetUseTransparency() ? 1 : 0;
  LWSAVE_I1( saver, &cvalue, 1 );
  vparam_funcs->save( GetTransparency(), saver );
  LWSAVE_END( saver );

  // Refraction
  LWSAVE_BEGIN( saver, &illumisurf_io_root[ ISIOID_REFR ], 1 );
  cvalue = GetUseRefraction() ? 1 : 0;
  LWSAVE_I1( saver, &cvalue, 1 );
  vparam_funcs->save( GetRefraction(), saver );
  LWSAVE_END( saver );

  // Translucency
  LWSAVE_BEGIN( saver, &illumisurf_io_root[ ISIOID_TRNC ], 1 );
  cvalue = GetUseTranslucency() ? 1 : 0;
  LWSAVE_I1( saver, &cvalue, 1 );
  vparam_funcs->save( GetTranslucency(), saver );
  LWSAVE_END( saver );

  LWSAVE_END( saver );

  return NULL;
}
예제 #10
0
// Load():
const char * IllumiSurf_Instance::Load( const LWLoadState *loader ) {
  char cvalue;

  if( ISIOPRE_ISFV == LWLOAD_FIND( loader, illumisurf_io_isfv ) ) {
    LWLOAD_I1( loader, &cvalue, 1 );
    if( cvalue != 1 )
      return "IllumiSurf Error:  Unsupported version found, aborting load";

    while( int id = LWLOAD_FIND( loader, illumisurf_io_root ) ) {
      switch( id ) {
        case ISIOPRE_BLND:
          LWLOAD_I1( loader, &cvalue, 1 );
          SetBlendMode( (IllumiSurf_BlendModes)cvalue );
          break;

        case ISIOPRE_BINT:
          vparam_funcs->load( GetBaseIntensity(), loader );
          break;

        case ISIOPRE_AINT:
          vparam_funcs->load( GetAltIntensity(), loader );
          break;

        case ISIOPRE_COLR:
          LWLOAD_I1( loader, &cvalue, 1 );
          SetUseColor( cvalue != 0 );
          vparam_funcs->load( GetColor(), loader );
          break;

        case ISIOPRE_LUMI:
          LWLOAD_I1( loader, &cvalue, 1 );
          SetUseLuminosity( cvalue != 0 );
          vparam_funcs->load( GetLuminosity(), loader );
          break;

        case ISIOPRE_DIFF:
          LWLOAD_I1( loader, &cvalue, 1 );
          SetUseDiffusion( cvalue != 0 );
          vparam_funcs->load( GetDiffusion(), loader );
          break;

        case ISIOPRE_SPEC:
          LWLOAD_I1( loader, &cvalue, 1 );
          SetUseSpecular( cvalue != 0 );
          vparam_funcs->load( GetSpecular(), loader );
          break;

        case ISIOPRE_GLOS:
          LWLOAD_I1( loader, &cvalue, 1 );
          SetUseGlossiness( cvalue != 0 );
          vparam_funcs->load( GetGlossiness(), loader );
          break;

        case ISIOPRE_REFL:
          LWLOAD_I1( loader, &cvalue, 1 );
          SetUseReflection( cvalue != 0 );
          vparam_funcs->load( GetReflection(), loader );
          break;

        case ISIOPRE_TRNP:
          LWLOAD_I1( loader, &cvalue, 1 );
          SetUseTransparency( cvalue != 0 );
          vparam_funcs->load( GetTransparency(), loader );
          break;

        case ISIOPRE_REFR:
          LWLOAD_I1( loader, &cvalue, 1 );
          SetUseRefraction( cvalue != 0 );
          vparam_funcs->load( GetRefraction(), loader );
          break;

        case ISIOPRE_TRNC:
          LWLOAD_I1( loader, &cvalue, 1 );
          SetUseTranslucency( cvalue != 0 );
          vparam_funcs->load( GetTranslucency(), loader );
          break;
      }

      LWLOAD_END( loader );            // End Keyword
    }

    LWLOAD_END( loader );            // End Keyword
  }

  return NULL;
}
예제 #11
0
void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice,
                                   CFX_Matrix* pUser2Device) {
  CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device);

  CFX_FloatRect rcClient = GetClientRect();
  CFX_ByteTextBuf sLine;

  int32_t nCharArray = m_pEdit->GetCharArray();
  FX_SAFE_INT32 nCharArraySafe = nCharArray;
  nCharArraySafe -= 1;
  nCharArraySafe *= 2;

  if (nCharArray > 0 && nCharArraySafe.IsValid()) {
    switch (GetBorderStyle()) {
      case BorderStyle::SOLID: {
        CFX_GraphStateData gsd;
        gsd.m_LineWidth = (FX_FLOAT)GetBorderWidth();

        CFX_PathData path;

        for (int32_t i = 0; i < nCharArray - 1; i++) {
          path.AppendPoint(
              CFX_PointF(
                  rcClient.left +
                      ((rcClient.right - rcClient.left) / nCharArray) * (i + 1),
                  rcClient.bottom),
              FXPT_TYPE::MoveTo, false);
          path.AppendPoint(
              CFX_PointF(
                  rcClient.left +
                      ((rcClient.right - rcClient.left) / nCharArray) * (i + 1),
                  rcClient.top),
              FXPT_TYPE::LineTo, false);
        }
        if (!path.GetPoints().empty()) {
          pDevice->DrawPath(&path, pUser2Device, &gsd, 0,
                            GetBorderColor().ToFXColor(255), FXFILL_ALTERNATE);
        }
        break;
      }
      case BorderStyle::DASH: {
        CFX_GraphStateData gsd;
        gsd.m_LineWidth = (FX_FLOAT)GetBorderWidth();

        gsd.SetDashCount(2);
        gsd.m_DashArray[0] = (FX_FLOAT)GetBorderDash().nDash;
        gsd.m_DashArray[1] = (FX_FLOAT)GetBorderDash().nGap;
        gsd.m_DashPhase = (FX_FLOAT)GetBorderDash().nPhase;

        CFX_PathData path;
        for (int32_t i = 0; i < nCharArray - 1; i++) {
          path.AppendPoint(
              CFX_PointF(
                  rcClient.left +
                      ((rcClient.right - rcClient.left) / nCharArray) * (i + 1),
                  rcClient.bottom),
              FXPT_TYPE::MoveTo, false);
          path.AppendPoint(
              CFX_PointF(
                  rcClient.left +
                      ((rcClient.right - rcClient.left) / nCharArray) * (i + 1),
                  rcClient.top),
              FXPT_TYPE::LineTo, false);
        }
        if (!path.GetPoints().empty()) {
          pDevice->DrawPath(&path, pUser2Device, &gsd, 0,
                            GetBorderColor().ToFXColor(255), FXFILL_ALTERNATE);
        }
        break;
      }
      default:
        break;
    }
  }

  CFX_FloatRect rcClip;
  CPVT_WordRange wrRange = m_pEdit->GetVisibleWordRange();
  CPVT_WordRange* pRange = nullptr;
  if (!HasFlag(PES_TEXTOVERFLOW)) {
    rcClip = GetClientRect();
    pRange = &wrRange;
  }

  CFX_SystemHandler* pSysHandler = GetSystemHandler();
  CFX_Edit::DrawEdit(pDevice, pUser2Device, m_pEdit.get(),
                     GetTextColor().ToFXColor(GetTransparency()), rcClip,
                     CFX_PointF(), pRange, pSysHandler, m_pFormFiller);
}