Ejemplo n.º 1
0
void WMSelectTextFieldRange(WMTextField * tPtr, WMRange range)
{
	CHECK_CLASS(tPtr, WC_TextField);

	if (tPtr->flags.enabled) {
		normalizeRange(tPtr, &range);

		tPtr->selection = range;

		tPtr->cursorPosition = range.position + range.count;

		if (tPtr->view->flags.realized) {
			paintTextField(tPtr);
		}
	}
}
Ejemplo n.º 2
0
void WMDeleteTextFieldRange(WMTextField * tPtr, WMRange range)
{
	CHECK_CLASS(tPtr, WC_TextField);

	normalizeRange(tPtr, &range);

	if (!range.count)
		return;

	memmv(&(tPtr->text[range.position]), &(tPtr->text[range.position + range.count]),
	      tPtr->textLen - (range.position + range.count) + 1);

	/* better than nothing ;) */
	if (tPtr->cursorPosition > range.position)
		tPtr->viewPosition += oneUTF8CharBackward(&tPtr->text[tPtr->viewPosition], tPtr->viewPosition);
	tPtr->textLen -= range.count;
	tPtr->cursorPosition = range.position;

	decrToFit(tPtr);

	paintTextField(tPtr);
}
Ejemplo n.º 3
0
static HTMLElement* highestAncestorToWrapMarkup(
    const PositionTemplate<Strategy>& startPosition,
    const PositionTemplate<Strategy>& endPosition,
    EAnnotateForInterchange shouldAnnotate,
    Node* constrainingAncestor) {
  Node* firstNode = startPosition.nodeAsRangeFirstNode();
  // For compatibility reason, we use container node of start and end
  // positions rather than first node and last node in selection.
  Node* commonAncestor =
      Strategy::commonAncestor(*startPosition.computeContainerNode(),
                               *endPosition.computeContainerNode());
  DCHECK(commonAncestor);
  HTMLElement* specialCommonAncestor = nullptr;
  if (shouldAnnotate == AnnotateForInterchange) {
    // Include ancestors that aren't completely inside the range but are
    // required to retain the structure and appearance of the copied markup.
    specialCommonAncestor =
        ancestorToRetainStructureAndAppearance(commonAncestor);
    if (Node* parentListNode = enclosingNodeOfType(
            firstPositionInOrBeforeNode(firstNode), isListItem)) {
      EphemeralRangeTemplate<Strategy> markupRange =
          EphemeralRangeTemplate<Strategy>(startPosition, endPosition);
      EphemeralRangeTemplate<Strategy> nodeRange = normalizeRange(
          EphemeralRangeTemplate<Strategy>::rangeOfContents(*parentListNode));
      if (nodeRange == markupRange) {
        ContainerNode* ancestor = parentListNode->parentNode();
        while (ancestor && !isHTMLListElement(ancestor))
          ancestor = ancestor->parentNode();
        specialCommonAncestor = toHTMLElement(ancestor);
      }
    }

    // Retain the Mail quote level by including all ancestor mail block quotes.
    if (HTMLQuoteElement* highestMailBlockquote =
            toHTMLQuoteElement(highestEnclosingNodeOfType(
                firstPositionInOrBeforeNode(firstNode),
                isMailHTMLBlockquoteElement, CanCrossEditingBoundary)))
      specialCommonAncestor = highestMailBlockquote;
  }

  Node* checkAncestor =
      specialCommonAncestor ? specialCommonAncestor : commonAncestor;
  if (checkAncestor->layoutObject()) {
    HTMLElement* newSpecialCommonAncestor =
        toHTMLElement(highestEnclosingNodeOfType(
            Position::firstPositionInNode(checkAncestor),
            &isPresentationalHTMLElement, CanCrossEditingBoundary,
            constrainingAncestor));
    if (newSpecialCommonAncestor)
      specialCommonAncestor = newSpecialCommonAncestor;
  }

  // If a single tab is selected, commonAncestor will be a text node inside a
  // tab span. If two or more tabs are selected, commonAncestor will be the tab
  // span. In either case, if there is a specialCommonAncestor already, it will
  // necessarily be above any tab span that needs to be included.
  if (!specialCommonAncestor && isTabHTMLSpanElementTextNode(commonAncestor))
    specialCommonAncestor =
        toHTMLSpanElement(Strategy::parent(*commonAncestor));
  if (!specialCommonAncestor && isTabHTMLSpanElement(commonAncestor))
    specialCommonAncestor = toHTMLSpanElement(commonAncestor);

  if (HTMLAnchorElement* enclosingAnchor =
          toHTMLAnchorElement(enclosingElementWithTag(
              Position::firstPositionInNode(specialCommonAncestor
                                                ? specialCommonAncestor
                                                : commonAncestor),
              aTag)))
    specialCommonAncestor = enclosingAnchor;

  return specialCommonAncestor;
}
Ejemplo n.º 4
0
/**
 * 保存/読込処理
 */
void Option::Sync(bool bSave)
{
	inifile::IniFile inifile;

	// ProMode
	if (theApp.m_bProMode && !bSave) {
		// スキンのデフォルト値を変更
#ifdef WINCE
		m_strSkinname = L"dark";
#endif
	}

	//--- 初期処理
	if (bSave) {
		// 保存時の初期処理
	} else {
		// 読込時の初期処理
		const CString& fileName = theApp.m_filepath.inifile;

		CFileStatus rStatus;
		if (CFile::GetStatus(fileName, rStatus) == FALSE) {
			inifile::StaticMethod::Create( util::my_wcstombs((LPCTSTR)fileName).c_str() );
		}

		if(! inifile.Load( theApp.m_filepath.inifile ) ) {
	//		return;
		}
	}

	//--- General
	SyncIniValue(inifile, bSave, (int&)m_StartupTransitionDoneType, "StartupMessageDoneType", "General" );
	SyncIniValue(inifile, bSave, m_bConfirmOpenURL, "ConfirmOpenURL", "General" );
//	SyncIniValue(inifile, bSave, m_bConvertUrlForMixiMobile, "ConvertUrlForMixiMobile", "General" );
	SyncIniValue(inifile, bSave, m_bUseDevVerCheck, "UseDevVerCheck", "General");

	// 起動時に絵文字ファイルを自動取得する
	SyncIniValue(inifile, bSave, m_bAutoDownloadEmojiImageFiles, "AutoDownloadEmojiImageFiles", "General" );

	//--- Proxy
	SyncIniValue(inifile, bSave, m_bUseProxy,		"Use",			  "Proxy");
	SyncIniValue(inifile, bSave, m_bUseGlobalProxy, "UseGlobalProxy", "Proxy");

	SyncIniValue(inifile, bSave, m_proxyServer,     "Server",		  "Proxy");
	SyncIniValue(inifile, bSave, m_proxyPort,       "Port",		      "Proxy");
	SyncIniValue(inifile, bSave, m_proxyUser,       "User",		      "Proxy");
	SyncIniValue(inifile, bSave, m_proxyPassword,   "Password",		  "Proxy");

	//--- Page
#ifdef BT_MZ3
	SyncIniValue(inifile, bSave, (int&)m_GetPageType, "GetType", "Page");
#endif

	//--- Boot
	SyncIniValue(inifile, bSave, m_bBootCheckMnC, "CheckMnC", "Boot");

	//--- UI
	// バルーン表示有無
	SyncIniValue(inifile, bSave, m_bShowBalloonOnNewTL, "ShowBalloonOnNewTL", "UI");

	// 背景画像の有無
	SyncIniValue(inifile, bSave, m_bUseBgImage, "UseBgImage", "UI");

	// フォントサイズ
	if (!bSave) {
		// 初期値設定
#ifdef WINCE
//		switch( theApp.GetDisplayMode() ) {
//		case SR_VGA:		m_fontHeight = 24; break;
//		case SR_QVGA:
//		default:			m_fontHeight = 12; break;
//		}
		m_fontHeight = 9;
#else
		m_fontHeight = 11;
#endif
	}
	SyncIniValue(inifile, bSave, m_fontHeight, "FontHeight", "UI");

	// フォント名
	SyncIniValue(inifile, bSave, m_fontFace, "FontFace", "UI");

	// ClearType
	SyncIniValue(inifile, bSave, m_bUseClearTypeFont, "ClearTypeFont", "UI");

	// Xcrawl 誤動作防止機能
	SyncIniValue(inifile, bSave, m_bUseXcrawlExtension, "UseXcrawlCanceler", "UI" );

	// ダウンロード後の実行確認画面を表示する?
	SyncIniValue(inifile, bSave, m_bUseRunConfirmDlg, "UseRunConfirmDlg", "UI" );

	// 長押し判定時間
	SyncIniValue(inifile, bSave, m_longReturnRangeMSec, "LongReturnRangeMSec", "UI" );

	// 引用符号
	if (bSave) {
		// 引用符号
		// 末尾の半角スペースを保存するため、
		// "/" で囲む形で保存する
		inifile.SetValue( L"QuoteMark", L"/" + m_quoteMark + L"/", "UI" );
	} else {
		// 引用符号
		std::string s = inifile.GetValue( "QuoteMark", "UI" );
		if( s.empty() ) {
			// 初期値をそのまま使う
		}else{
			m_quoteMark = s.c_str();
			// 先頭と末尾の "/" を削除する
			if( m_quoteMark.Left(1) == L"/" ) {
				m_quoteMark.Delete( 0 );
			}
			if( m_quoteMark.Right(1) == L"/" ) {
				m_quoteMark.Delete( m_quoteMark.GetLength()-1 );
			}
		}
	}

	//--- UI 系
	// リストの高さ(比率)
	const int RATIO_MAX = 1000;
	SyncIniValue(inifile, bSave, m_nMainViewCategoryListHeightRatio, "MainViewCategoryListHeightRatio", "UI" );
	if (!bSave) {
		// normalize
		m_nMainViewCategoryListHeightRatio = normalizeRange(m_nMainViewCategoryListHeightRatio, 1, RATIO_MAX );
	}
	SyncIniValue(inifile, bSave, m_nMainViewBodyListHeightRatio, "MainViewBodyListHeightRatio", "UI" );
	if (!bSave) {
		// normalize
		m_nMainViewBodyListHeightRatio = normalizeRange( m_nMainViewBodyListHeightRatio, 1, RATIO_MAX );
	}
	SyncIniValue(inifile, bSave, m_nReportViewListHeightRatio, "ReportViewListHeightRatio", "UI" );
	if (!bSave) {
		// normalize
		m_nReportViewListHeightRatio = normalizeRange( m_nReportViewListHeightRatio, 1, RATIO_MAX );
	}
	SyncIniValue(inifile, bSave, m_nReportViewBodyHeightRatio, "ReportViewBodyHeightRatio", "UI" );
	if (!bSave) {
		// normalize
		m_nReportViewBodyHeightRatio = normalizeRange( m_nReportViewBodyHeightRatio, 1, RATIO_MAX );
	}

	// リストのカラム幅(比率)
	SyncIniValue(inifile, bSave, m_nMainViewBodyListCol1Ratio, "MainViewBodyListCol1Ratio", "UI" );
	if (!bSave) {
		// normalize
		m_nMainViewBodyListCol1Ratio = normalizeRange( m_nMainViewBodyListCol1Ratio, 1, RATIO_MAX );
	}
	SyncIniValue(inifile, bSave, m_nMainViewBodyListCol2Ratio, "MainViewBodyListCol2Ratio", "UI" );
	if (!bSave) {
		// normalize
		m_nMainViewBodyListCol2Ratio = normalizeRange( m_nMainViewBodyListCol2Ratio, 1, RATIO_MAX );
	}
	SyncIniValue(inifile, bSave, m_nMainViewCategoryListCol1Ratio, "MainViewCategoryListCol1Ratio", "UI" );
	if (!bSave) {
		// normalize
		m_nMainViewCategoryListCol1Ratio = normalizeRange( m_nMainViewCategoryListCol1Ratio, 1, RATIO_MAX );
	}
	SyncIniValue(inifile, bSave, m_nMainViewCategoryListCol2Ratio, "MainViewCategoryListCol2Ratio", "UI" );
	if (!bSave) {
		// normalize
		m_nMainViewCategoryListCol2Ratio = normalizeRange( m_nMainViewCategoryListCol2Ratio, 1, RATIO_MAX );
	}
	SyncIniValue(inifile, bSave, m_nReportViewListCol1Ratio, "ReportViewListCol1Ratio", "UI" );
	if (!bSave) {
		// normalize
		m_nReportViewListCol1Ratio = normalizeRange( m_nReportViewListCol1Ratio, 1, RATIO_MAX );
	}
	SyncIniValue(inifile, bSave, m_nReportViewListCol2Ratio, "ReportViewListCol2Ratio", "UI" );
	if (!bSave) {
		// normalize
		m_nReportViewListCol2Ratio = normalizeRange( m_nReportViewListCol2Ratio, 1, RATIO_MAX );
	}
	SyncIniValue(inifile, bSave, m_nReportViewListCol3Ratio, "ReportViewListCol3Ratio", "UI" );
	if (!bSave) {
		// normalize
		m_nReportViewListCol3Ratio = normalizeRange( m_nReportViewListCol3Ratio, 1, RATIO_MAX );
	}

	// レポート画面のスクロールタイプ
	SyncIniValue(inifile, bSave, (int&)m_reportScrollType, "ReportScrollType", "UI" );
	if (!bSave) {
		// check
		switch (m_reportScrollType) {
		case option::Option::REPORT_SCROLL_TYPE_LINE:
		case option::Option::REPORT_SCROLL_TYPE_PAGE:
			break;
		default:
			MZ3LOGGER_ERROR( L"ReportScrollType が規定値以外です" );
			m_reportScrollType = option::Option::REPORT_SCROLL_TYPE_LINE;
			break;
		}
	}

	// レポート画面のスクロール行数
	SyncIniValue(inifile, bSave, m_reportScrollLine, "ReportScrollLine", "UI" );
	if (!bSave) {
		// normalize
		m_reportScrollLine = normalizeRange( m_reportScrollLine, 1, 100 );
	}

	// らんらんビューのパンスクロール
	SyncIniValue(inifile, bSave, m_bUseRan2PanScrollAnimation, "UseRan2PanScrollAnimation", "UI" );

	// 横ドラッグでの項目移動
	SyncIniValue(inifile, bSave, m_bUseRan2HorizontalDragMove, "UseRan2HorizontalDragMove", "UI" );

	// ダブルクリックでの項目移動
	SyncIniValue(inifile, bSave, m_bUseRan2DoubleClickMove, "UseRan2DoubleClickMove", "UI" );

	// MZ3(WM)でピクセル単位スクロールを実行するか?
	SyncIniValue(inifile, bSave, m_bListScrollByPixelOnMZ3, "ListScrollByPixelOnMZ3", "UI");

	// スキン名
	SyncIniValue(inifile, bSave, m_strSkinname, "SkinName", "UI" );

#ifndef WINCE
	// ウィンドウ位置・サイズ
	SyncIniValue(inifile, bSave, m_strWindowPos, "WindowPos", "UI" );
#endif

	// 定期取得間隔
	SyncIniValue(inifile, bSave, m_nIntervalCheckSec, "IntervalCheckSec", "UI" );
	if(!bSave) {
		// normalize
		m_nIntervalCheckSec = normalizeIntervalCheckSec(m_nIntervalCheckSec);
	}

	// 定期取得有効・無効
	SyncIniValue(inifile, bSave, m_bEnableIntervalCheck, "EnableIntervalCheck", "UI" );

	// 前回終了時のタブのインデックス
	SyncIniValue(inifile, bSave, m_lastTopPageTabIndex, "LastTopPageTabIndex", "UI" );

	// 前回終了時のカテゴリのインデックス
	SyncIniValue(inifile, bSave, m_lastTopPageCategoryIndex, "LastTopPageCategoryIndex", "UI" );

	// Treo用の画面節約モード::ペインのラベル非表示
	SyncIniValue(inifile, bSave, m_killPaneLabel, "KillPaneLabel", "UI" );

	//--- Log 関連
	// 保存フラグ
	SyncIniValue(inifile, bSave, m_bSaveLog, "SaveLog", "Log" );

	// ログフォルダ
	SyncIniValue(inifile, bSave, m_logFolder, "LogFolder", "Log" );

	// デバッグモード フラグ
	SyncIniValue(inifile, bSave, m_bDebugMode, "DebugMode", "Log" );

	//--- Net
	// 受信バッファサイズ
	SyncIniValue(inifile, bSave, m_recvBufSize, "RecvBufferSize", "Net");

	// 自動接続
	SyncIniValue(inifile, bSave, m_bUseAutoConnection, "AutoConnect", "Net");

	// 総データ受信量
	SyncIniValue(inifile, bSave, m_totalRecvBytes, "TotalRecvBytes", "Net");

	// User-Agent
	SyncIniValue(inifile, bSave, m_strUserAgent, "UserAgent", "Net" );

	// 通信中のプログレスバー表示
	SyncIniValue(inifile, bSave, m_bShowNetProgressBar, "ShowNetProgressBar", "Net");

	//--- メイン画面
	// トピック等にアイコンを表示する?
	SyncIniValue(inifile, bSave, m_bShowMainViewIcon, "ShowMainViewIcon", "MainView");

	// ユーザやコミュニティの画像を表示する?
	SyncIniValue(inifile, bSave, m_bShowMainViewMiniImage, "ShowMainViewMiniImage", "MainView");
	
	// 画像の自動取得
	SyncIniValue(inifile, bSave, m_bAutoLoadMiniImage, "AutoLoadMiniImage", "MainView");

	// ボディリストのカラムの統合モード
	SyncIniValue(inifile, bSave, m_bBodyListIntegratedColumnMode, "MainViewBodyListIntegratedColumnMode", "MainView");

	// ボディリストのカラムの統合モード行数
	SyncIniValue(inifile, bSave, m_nBodyListIntegratedColumnModeLine, "MainViewBodyListIntegratedColumnModeLine", "MainView");

	// カテゴリリストの行数
	SyncIniValue(inifile, bSave, m_nCategoryListLine, "MainViewCategoryListLine", "MainView");
	if (!bSave) {
		m_nCategoryListLine = normalizeRange(m_nCategoryListLine, 1, 3);
	}

	// 上ペインのリストクリック時に取得する
	SyncIniValue(inifile, bSave, m_bOneClickCategoryFetchMode, "MainViewOneClickCategoryFetchMode", "MainView");

	// 起動時に上ペインを最大化する
	SyncIniValue(inifile, bSave, m_bMagnifyModeCategoryAtStart, "MainViewMagnifyModeCategoryAtStart", "MainView");

	// アイコンサイズ
	int size = (int)m_bodyListIconSize;
	SyncIniValue(inifile, bSave, size, "BodyListIconSize", "MainView");
	m_bodyListIconSize = (option::Option::BODYLIST_ICONSIZE)size;

	//--- Twitter
	SyncIniValue(inifile, bSave, m_bAddSourceTextOnTwitterPost, "AddSourceTextOnTwitterPost", "Twitter");
	SyncIniValue(inifile, bSave, m_strTwitterPostFotterText, "PostFotterText", "Twitter" );
	SyncIniValue(inifile, bSave, m_nTwitterStatusLineCount, "TwitterStatusLineCount", "Twitter");
	if (!bSave) {
		// normalize
		m_nTwitterStatusLineCount = normalizeTwitterStatusLineCount(m_nTwitterStatusLineCount);
	}
	SyncIniValue(inifile, bSave, m_nTwitterGetPageCount, "GetPageCount", "Twitter");
	if (!bSave) {
		// normalize
		m_nTwitterGetPageCount = normalizeTwitterGetPageCount(m_nTwitterGetPageCount);
	}
	SyncIniValue(inifile, bSave, m_bTwitterReloadTLAfterPost, "ReloadTLAfterPost", "Twitter");
	SyncIniValue(inifile, bSave, m_bTwitterCursorRestoreAfterTLFetch, "CursorRestoreAfterTLFetch", "Twitter");
	SyncIniValue(inifile, bSave, m_nTwitterRTStyle, "TwitterRTStyle", "Twitter");

	// 終了処理
	if (bSave) {
		// Save
		inifile.Save( theApp.m_filepath.inifile, false );
	}
}